-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[@xstate/inspect] Handle circular references gracefully in inspector. #1699
Conversation
|
const devTools = createDevTools(); | ||
|
||
devTools.onRegister(() => { | ||
done(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
q: is this crucial for this test? or could we just stick to the "not throw" expectation on the end? I mean - onRegister
gets called synchronously as far as i can see so this done()
here in the middle of a test is slightly distracting (if only it can be avoided, i might miss something)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the future, register/onRegister may be async, and if that happens, this test will fail.
Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
This PR fixes stringifying circular reference in
@xstate/inspect
by using fast-safe-stringify when normalJSON.stringify(...)
throws.Currently, this will result in the string
"[Circular]"
in the inspect UI, which is much better than completely failing (previous behavior):Fixes #1497