Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> What if you have a modal opened with some state?

Stimulus controllers can store state.

> Or a form filled with data?

Again, you can either use a Stimulus controller, or you can just render the data into the form response, depending on the situation.

> Or some multi-selection in a list of items that triggers a menu of actions on those items?

So, submenus? Again, you can either do it in a Stimulus controller (you can even trivially do things like provide a new submenu on the fly via Turbo), or you can pre-render the entire menu tree server-side and update just the portion that changes.

None of these are complex examples.



> Stimulus controllers can store state.

Yes, obviously, but do these maintain state after hot reload?


We're talking about two entirely different things that lead to the same outcome. The approach we're describing is not a "hot reload" per se, it's just selectively updating the changed contents of the page. For the vast majority of the changes you do during development, this is invisible to you.

If you change the JS or the controller itself, obviously, state stored in JS would be lost unless you persisted it locally somehow.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: