debugger icon indicating copy to clipboard operation
debugger copied to clipboard

handle dispatch of message type from devtools

Open joprice opened this issue 1 year ago • 2 comments

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 avatar Nov 12 '24 19:11 joprice

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.

joprice avatar Nov 13 '24 00:11 joprice

Hello,

If the above improve the current situation and don't break anything personally I am ok with adding it.

MangelMaxime avatar Nov 21 '24 14:11 MangelMaxime

@joprice Now there is the function Program.withDebuggerOptions which takes an argument of type ExtensionOptions. Currently, this type only has the field name, but actionCreators could be added. PR welcome :)

mardukbp avatar May 06 '25 20:05 mardukbp