fable-compiler / Fable.Lit

Write Fable Elmish apps with Lit
https://fable.io/Fable.Lit/
MIT License
91 stars 13 forks source link

HookComponent HMR support for Vite/Snowpack #15

Closed alfonsogarciacaro closed 2 years ago

alfonsogarciacaro commented 2 years ago

Quite excited about this, after some trial-and-error I found a way to make HookComponents compatible with HMR in non-bundling dev servers. It requires some code (user must create an HMR token and pass it to the components) but it's zero config and doesn't need any plugin.

In the screencast, note the opening transition of the clock is not triggered with the update. Only the HookComponent (LocalInput) is updated while keeping internal state. In a simple application like this probably doesn't make much difference with Webpack, but in a big project it can really speed up the feedback loop when adjusting the UI.

screencast

With testing and IDE tooling this is the last piece of the puzzle for an awesome development experience. The only thing left now is write some docs and we're ready for a great official release!