You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<div {{ stimulus_controller('my-date-picker') }}>
<inputtype="text"> <!-- the date field that will be transformed</div>
A) You add a JS widget inside your live component - e.g. a date picker - via a stimulus controller
B) That widget modifies the markup of part of your widget
C) On re-render, the modified markup is "reset" back to its original state, effectively killing your JS widget functionality
One solution to this is to force live components to ALWAYS fully re-render the entire div element attached to the Stimulus controller.. This forces the existing Stimulus controller (which loads the date picker) to be destroyed and totally reinitializing. So now, step (C) is different:
C) On re-render, the entire date picker element is re-rendered from scratch, causing the Stimulus controller to reinitialize and the date picker functionality to be re-added.
Current Solution
Currently, this is possible by doing something silly like this:
Great news that an issue is open to allow a re-render configuration using attribute !
By on onChange i meant the default behavior, maybe default is more appropriate ?
Or may be we should not set the attribute at all, we have to think if that attribute can be changed in some scenario, in this case it may be interesting to able to reset the default re-render
Hi!
Inspired by: #489 (comment)
tl;dr: Suppose you have:
A) You add a JS widget inside your live component - e.g. a date picker - via a stimulus controller
B) That widget modifies the markup of part of your widget
C) On re-render, the modified markup is "reset" back to its original state, effectively killing your JS widget functionality
One solution to this is to force live components to ALWAYS fully re-render the entire
div
element attached to the Stimulus controller.. This forces the existing Stimulus controller (which loads the date picker) to be destroyed and totally reinitializing. So now, step (C) is different:C) On re-render, the entire date picker element is re-rendered from scratch, causing the Stimulus controller to reinitialize and the date picker functionality to be re-added.
Current Solution
Currently, this is possible by doing something silly like this:
The always-changing
data-live-id
tells live components to always re-render this.Proposed Solution
@tdumalin proposed something like:
With possible values of:
A)
always
- ALWAYS re-render this elementB)
never
- would replacedata-live-ignore
C)
onChange
- @tdumalin what did you have in mind for this?The text was updated successfully, but these errors were encountered: