sveltejs / kit

web development, streamlined
https://svelte.dev/docs/kit
MIT License
18.73k stars 1.95k forks source link

Dynamic update #12073

Open AlexRMU opened 7 months ago

AlexRMU commented 7 months ago

Describe the problem

Sometimes the changes in the new version are so minor that updating the page and all the resources to apply them is very inefficient. I suggest creating a dynamic update feature similar to hot reload.

Describe the proposed solution

The idea is very crude.

I suggest:

Dynamic update:

  1. a certain manifest is updated
  2. it is compared with the current version manifest
  3. only the modified parts of the application are updated
    • static assets are being reloaded
    • sw is being updated (https://github.com/sveltejs/kit/issues/3667)
    • server side and endpoints with load dependencies are updated, live connections are not interrupted
    • components are being updated, other components are not affected and their state does not change
      • for example, the page component has changed, it is being reloaded, but the layout component is not affected, as if normal navigation had occurred
      • for example, a component has changed in the depth of the page, and if the component is usually imported and treated as a constant, now it becomes a reactive variable and restarts the dependent code when updating

It seems like it's going to be difficult or impossible.

Alternatives considered

No response

Importance

nice to have

Additional Information

https://rauchg.com/2014/7-principles-of-rich-web-applications#push-code-updates https://github.com/gaearon/react-hot-loader/issues/38

AlexRMU commented 7 months ago

You can create a component that will allow/disallow update for its children. Or make an additional option in the svelte:options.