statelyai / rfcs

RFCs for XState and Stately tools
44 stars 5 forks source link

DevTools Protocol #11

Closed davidkpiano closed 2 years ago

davidkpiano commented 2 years ago

View rendered text

tom-sherman commented 2 years ago

Can this help with inspecting a service with hundreds of actors? The inspector takes absolutely forever to start up in this case at the moment

davidkpiano commented 2 years ago

Can this help with inspecting a service with hundreds of actors? The inspector takes absolutely forever to start up in this case at the moment

That's a good consideration - can you identify specifically what the bottleneck is?

tom-sherman commented 2 years ago

Look like the bottleneck right now is that a message is sent for each actor. This RFC appears to solve the issue via the @xstate/inspect.actors event - cool!

davidkpiano commented 2 years ago

Notes from @Andarist:

davidkpiano commented 2 years ago

TODO: consider a "restart" event that the inspector can send the client for individual actors? cc. @farskid

SimeonC commented 2 years ago

This looks great. I think the notes that @Andarist made are important for the implementation I made for storybook - particularly Need a way for the client to request actor snapshots from inspector at any time. Putting the inspector in as a storybook addon requires use of the storybook “message bus” to get from the iframe with running machines to the iframe that the devtools are loaded in, which is in essence another postmessage system. This indirection leads to very long startup times for the addon as I have to make sure that everything is started up in sequence meaning that sometimes I can’t catch the first few events on startup.

one other thing I did in the addon was to alter the default of devTools as passed to inspect here: https://github.com/SimeonC/storybook-xstate-addon/blob/main/src/preset/withXstateInspector.ts#L18