Stimulus and Turbolinks were designed to play well with one another. It’s been hinted in a couple different places that it’s possible to level up a view with a component from one of the component frameworks (Vue or React) in the places where a feature requires that degree of complexity (ex. Basecamp’s calendar). @sam or @javan, would you be willing to comment on how Basecamp approaches this scenario?
Specifically, how do you get your components to play nice with the Turbolinks cache? Is there a pattern you leverage in your Stimulus controllers and client side components?
In Vue, for example, you have to cache the element you’re mounting the component on before the component mounts so that when you go back and the JS is re-executed the element exists. Often the element doesn’t exist after the component is mounted. It’s been replaced by whatever HTML is created by the component. Chris Oliver and I created a plugin for Vue to help us solve this problem.
Can you speak to how you approach this problem in light of Stimulus and Turbolinks? Maybe in the context of the Basecamp calendar?