fable-compiler / Fable.Lit

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

Hook.Elmish doesn't rerun when props change #77

Closed OnurGumus closed 1 year ago

OnurGumus commented 1 year ago

When you use Hook.useElmish inside a LitComponent, it re-renders when props change. But doesn't re-run the elmish loop making state doesn't change.

OnurGumus commented 1 year ago

Created this PR https://github.com/fable-compiler/Fable.Lit/pull/78

Though I have a concern.

Should we really rerun elmish when props of lit element has changed? I am inclined to do so. Secondly, not sure if we should clean subscriptions the previous elmish loop had some.

OnurGumus commented 1 year ago

Neah I found a better approach. I can call the dispatcher directly to update to model with incoming values.