Greetings everyone,
I wanted to share an issue we’ve encountered while integrating Turbo into our Symfony Vs Stimulus setup.
Following the addition of Turbo, we’ve noticed a peculiar behavior: upon Turbo replacing the body of the page, all Stimulus controllers rerun, as expected. However, unexpectedly, all event listeners are duplicated.
Upon inspecting the console, we’ve observed that controllers are disconnecting and then reconnecting. We hadn’t implemented unsubscription on the disconnect event for any addEventListener previously, as it wasn’t necessary due to full page reloads.
Our assumption was that replacing the body would discard former event listeners, but this doesn’t seem to be the case.
While we’re excited about incorporating Turbo into our app, these critical issues it introduces are concerning. We’re hopeful that with your expertise, we can find solutions to address these challenges.
Thank you for your attention and support.