Skip to content
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

Persist components' state across hot page reloads #1

Open
2 tasks
kjeske opened this issue Oct 1, 2023 · 1 comment
Open
2 tasks

Persist components' state across hot page reloads #1

kjeske opened this issue Oct 1, 2023 · 1 comment
Assignees
Labels
enhancement New feature or request hot-reload

Comments

@kjeske
Copy link
Contributor

kjeske commented Oct 1, 2023

When using built-in ASP.NET Core mechanism for hot reloading pages after changing source code, the whole page is being reloaded, therefore all the components loose their state. It's inconvenient when working on some places deep down the component hierarchy that resets every time.

Possible solution would be to add a custom hot-reload mechanism that will send messages via web sockets stream. As a response, browser could send a request to the back-end for the new version of current page, but additionally all the state would be sent together with that request.

To do:

  • Investigate
  • Implement
@kjeske kjeske self-assigned this Oct 1, 2023
@kjeske kjeske added enhancement New feature or request hot-reload labels Oct 1, 2023
@taublast
Copy link
Contributor

Could add a property bool IsPersistent to the HydroComponent class, so that every persistent component will save its props marked with [Parameter] attribute to cookies after every rendering, then upon a new Mount (it is triggered upon HotReload right?) will restore values from cookies.

Could be totally done from code-behind without changing hydro.js. Doesn't keep all the state though.. Well, just an idea. Can be interesting for not only HotReload, like navigating through pages and automatically having all previous parameters restored from last usage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request hot-reload
Projects
None yet
Development

No branches or pull requests

2 participants