elmish / debugger

Time-traveling debugger and import export for Elmish apps
https://elmish.github.io/debugger
Other
41 stars 10 forks source link

handle dispatch of message type from devtools #71

Open joprice opened 6 days ago

joprice commented 6 days ago

Description

The redux devtools allow triggering actions from the UI, but the only message type currently handled by the elmish debugger is MsgTypes.Dispatch. I was able to modify the debugger code to support his by adding an inflater argument for the 'msg type:

| msg when msg.``type`` = MsgTypes.Action ->
          let msg: 'msg = msgInflater (JS.JSON.parse (!!msg.action))
          dispatch (msg)

I'm not very familiar with redux tooling, so not sure there's anything else to handle besides this, but this is enough to allow me to trigger side actions manually to easily reproduce side-effects.

joprice commented 6 days ago

I noticed the actionCreators config option that lets you provide a set of preconfigured values for sending actions, and it seems that it structures the actions in a way that are different than the serialized form. I'd like to make use of that, so I think my above suggestion is too naive.