lustre-labs / lustre

An Elm-inspired framework for building HTML templates, single page applications, and server-rendered components in Gleam!
https://hexdocs.pm/lustre
MIT License
744 stars 53 forks source link

Fix: avoid a race condition when dispatch is used twice from outside #8

Closed keroami closed 1 year ago

keroami commented 1 year ago

3-in-1

Fix: avoid a race condition when dispatch is used twice from outside

E.g. websocket open + websocket msg arriving Application returns a Cmd from update(model, msg) but the Effect handler is not ran be React 18 before the websocket msg-arriving is handled by the Reducer. Result: The Cmd returned by update(model, msg) is dropped silently.