- #3772
cea609ce3
Thanks @jlarmstrongiv! - Fixed an issue with a misleading dev-only warning being printed when inspecting machines because of the internalcreateMachine
call.
-
#3235
f666f5823
Thanks @mattpocock! -@xstate/inspect
will now targethttps://stately.ai/viz
by default. You can target the old inspector by setting the config options like so:inspect({ url: `https://statecharts.io/inspect` });
-
#3198
09e2130df
Thanks @Andarist! - Fixed an issue that prevented some states from being sent correctly to the inspector when serializable values hold references to objects throwing ontoJSON
property access (likeobj.toJSON
). This property is accessed by the native algorithm before the value gets passed to the customserializer
. Because of a bug we couldn't correctly serialize such values even when a customserializer
was implemented that was meant to replace it in a custom way from within its parent's level. -
#3199
f3d63147d
Thanks @Andarist! - Fixed an issue that caused sending the same event multiple times to the inspector for restarted services. -
#3076
34f3d9be7
Thanks @SimeonC! - Fixed an issue with "maximum call stack size exceeded" errors being thrown when registering a machine with a very deep object in its context despite using a serializer capable of replacing such an object.
-
#3144
e08030faf
Thanks @lecepin! - Added UMD build for this package that is available in thedist
directory in the published package. -
#3144
e08030faf
Thanks @lecepin! - Added properpeerDependency
on XState. It was incorrectly omitted from thepackage.json
of this package.
- #3089
862697e29
Thanks @Andarist! - Fixed compatibility with Skypack by exporting some shared utilities from root entry of XState and consuming them directly in other packages (this avoids accessing those things using deep imports and thus it avoids creating those compatibility problems).
- #2957
8550ddda7
Thanks @davidkpiano! - The repository links have been updated fromgithub.com/davidkpiano
togithub.com/statelyai
.
-
#2640
c73dfd655
Thanks @davidkpiano! - A serializer can now be specified as an option forinspect(...)
in the.serialize
property. It should be a replacer function:// ... inspect({ // ... serialize: (key, value) => { if (value instanceof Map) { return 'map'; } return value; } }); // ... // Will be inspected as: // { // type: 'EVENT_WITH_MAP', // map: 'map' // } someService.send({ type: 'EVENT_WITH_MAP', map: new Map() });
-
#2894
8435c5b84
Thanks @Andarist! - The package has been upgraded to be compatible with[email protected]
. The WS server created server-side has to be of a compatible version now.
- #2827
49de77085
Thanks @erlendfh! - Fixed a bug increateWebsocketReceiver
so that it works as expected with a WebSocket connection.
- #2728
8171b3e12
Thanks @jacksteamdev! - Fix server inspector to handle WebSocket messages as Buffer
4f006ffc
#2504 Thanks @Andarist! -Inspector
'ssubscribe
callback will now get immediately called with the current state at the subscription time.
e90b764e
#2492 Thanks @Andarist! - Fixed a minor issue with sometimes sendingundefined
state to the inspector which resulted in an error being thrown in it when resolving the received state. The problem was very minor as no functionality was broken because of it.
d9282107
#1800 Thanks @davidkpiano! - Fixed a bug where services were not being registered by the inspect client, affecting the ability to send events to inspected services.
-
63ba888e
#1770 Thanks @davidkpiano! - It is now easier for developers to create their own XState inspectors, and even inspect services offline.A receiver is an actor that receives inspector events from a source, such as
"service.register"
,"service.state"
,"service.event"
, etc. This update includes two receivers:createWindowReceiver
- listens to inspector events from a parent window (for both popup and iframe scenarios)- 🚧
createWebSocketReceiver
(experimental) - listens to inspector events from a WebSocket server
Here's how it works:
Application (browser) code
import { inspect } from '@xstate/inspect'; inspect(/* options */); // ... interpret(someMachine, { devTools: true }).start();
Inspector code
import { createWindowReceiver } from '@xstate/inspect'; const windowReceiver = createWindowReceiver(/* options? */); windowReceiver.subscribe((event) => { // here, you will receive events like: // { type: "service.register", machine: ..., state: ..., sessionId: ... } console.log(event); });
The events you will receive are
ParsedReceiverEvent
types:export type ParsedReceiverEvent = | { type: 'service.register'; machine: StateMachine<any, any, any>; state: State<any, any>; id: string; sessionId: string; parent?: string; source?: string; } | { type: 'service.stop'; sessionId: string } | { type: 'service.state'; state: State<any, any>; sessionId: string; } | { type: 'service.event'; event: SCXML.Event<any>; sessionId: string };
Given these events, you can visualize the service machines and their states and events however you'd like.
a473205d
#1699 Thanks @davidkpiano! - The@xstate/inspect
tool now usesfast-safe-stringify
for internal JSON stringification of machines, states, and events when regularJSON.stringify()
fails (e.g., due to circular structures).
1725333a
#1599 Thanks @davidkpiano! - The@xstate/inspect
package is now built with Rollup which has fixed an issue with TypeScript compiler inserting references tothis
in the top-level scope of the output modules and thus making it harder for some tools (like Rollup) to re-bundle dist files asthis
in modules (as they are always in strict mode) isundefined
.