New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Struggle with use case #4
Comments
Funny I've just found your post here: https://twitter.com/marcoroth_/status/1549272819556667392 |
Hey @pySilver, thanks for reaching out and bringing that up. Yeah, there are some "edge-cases" where morph operations could come in handy, where a regular update/replace operation could cause some issues. The most common one is loosing state which is stored on DOM elements or the reinitialization of Stimulus controllers if the root element or any children has controllers attached. But that also depends how you write your Stimulus controllers. For some you actually want to trigger a reinitialization, for exmaple if your controller is responsible for initializing tooltips within the newly morphed HTML content. But if your controller is responsible for handling audio/video you don't want that controller to be reinitialized because you would loose that state and cause the media to stop. It might be worth to convert that Twitter thread into a proper blog post for better visibility! Thanks! |
@marcoroth thanks for the quick reply! Yes, I think any kind of streaming media would be the perfect use case for morphs! |
Hey!
Thanks for the lib. I'm reading https://docs.stimulusreflex.com/rtfm/morph-modes to get better understanding of a real world benefits that morphdom brings comparing to typical
Turbo.StreamActions
(replace/update). Shame on me but I cannot find a good example where morphdom is better than typical stream update/replace action.Would you be so kind to provide more info on this?
The text was updated successfully, but these errors were encountered: