Debugger crashing when using union type for Model

In his Elm Europe 2018 talk Richard Feldman discusses using a union type for your Model. I really liked this idea, it helps to avoid polluting my main application state with state that is just used during initialization and then never again.

However when using this programming style, I find the time-travelling debugger that ships with elm-reactor crashes whenever you try to time-travel (with Uncaught TypeError: Cannot read property 'childNodes' of undefined). I have confirmed this with a tiny toy problem, so it’s not something specific to my code.

Is this a known issue, or should I file a bug (if so where is the best place)?

Does anybody know of a workaround? I suppose I could do something like:

type alias Model =
    { state : State }

type State
    = Initializing Config
    | MainProgram MainState

but it feels a little clunky.

Would you be able to link to the toy example on Ellie?

After finding that it crashed the Ellie app before I could even enter my code, I realised the problem was elsewhere.

It seems the Dark Reader chrome extension I use does not play nicely with the javascript used by Ellie and elm-reactor and causes it to crash. This took me a while to work out as it seems to sometimes even happen when Dark Reader is instructed to leave that particular page alone. I have filed a bug with Dark Reader (https://github.com/darkreader/darkreader/issues/623).

Maybe I should delete this post (although I’m not sure I know how to), now that it appears to be nothing to do with Elm? Or should I leave it in case anyone else ever finds the same problem?

1 Like

It’d be great if you could leave it up. This sounds like a weird problem, thank you for putting in the work to find it!

Edit: it’d be nice if you could mark your last post as the solution. I believe you can do that as the author. :smile:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.