Setting the data-room attribute on the StimulusController element.
Setting room in the body with a data attribute can pose a security risk. Consider assigning room when registering the Stimulus controller instead.
Stimulus Controllers
Render Delay
An attempt is made to reduce repaint jitter when users trigger several updates in succession.
You can control how long to wait prior to updating the DOM - think debounce. Simply set the renderDelay option in milliseconds when registering the controller.
renderDelay defaults to25milliseconds.
Reflexes
Server side reflexes inherit from StimulusReflex::Reflex and hold logic responsible for performing operations like writing to your backend data stores. Reflexes are not concerned with rendering because rendering is delegated to the Rails controller and action that originally rendered the page.
Properties
connection - the ActionCable connection
channel - the ActionCable channel
request - an ActionDispatch::Request proxy for the socket connection
session - the ActionDispatch::Session store for the current visitor
url - the URL of the page that triggered the reflex
element - a Hash like object that represents the HTML element that triggered the reflex
element
The element property contains all of the Stimulus controller's DOM element attributes as well as other properties like checked and value.
Most values are strings. The only exceptions are checked and selected which are booleans.
Here's an example that outlines how you can interact with the element property in your reflexes.