You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 20, 2018. It is now read-only.
On start up, my app randomizes its state as part of its init command:
main =
let
startupCmd =
Random.generate NewModel modelGenerator
in
Html.program
{ init = ( emptyModel, startupCmd )
, update = update
, view = view
, subscriptions = subscriptions
}
The problem here is that its NewModel message ticks after the app's previous state is injected.
Is this something that can be worked around by elm-hot-reload? If not, what about a way to signal to the app that it has been hot reloaded? That way I could simply not issue the startup command in those cases. e.g. :
main =
let
startupCmd =
Random.generate NewModel modelGenerator
init flags =
if flags.hotSwapped then
( emptyModel, Cmd.none )
else
( emptyModel, startupCmd )
in
Html.programWithFlags
{ init = init
, update = update startupCmd discoCmd
, view = view
, subscriptions = subscriptions
}