-
Notifications
You must be signed in to change notification settings - Fork 27.5k
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
update with-xstate example and add documentation for inspect package usage #23287
Conversation
examples/with-xstate/pages/index.js
Outdated
* In order to use the xstate inspect module, | ||
* we should check that we are on client, rather than the server | ||
*/ | ||
if (typeof window !== 'undefined') { |
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.
This is for local debugging, right? Is it good to include this by default?
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.
Yes, you're right, I added a check for the "development" mode, I don't know if it's actually sufficient. I wanted to show how we can implement the inspect mode with next.js as there's some issues using it without checking for the window object.
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.
Hmm, let's remove this from the code - but add instructions to the README if they want to use it. Sound good? This will prevent someone from shipping this code to prod - when really it seems like it's used for debug, yeah?
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.
Yeah ! good idea !
Yes, it's used for debugging/giving a visualization for differents machines used in the component. It shouldn't be in the production build !
I'll add it to the Readme and remove it from the code !
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.
I added it to the README ! Thanks
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.
Thank you!
…usage (vercel#23287) Hello this PR is in order to update xstate to the lastest version and use the `createMachine` method instead of `Machine`. I also added the inspect mode in order to show how we could use into a next.js app. ## Documentation / Examples - [x] Make sure the linting passes
…usage (vercel#23287) Hello this PR is in order to update xstate to the lastest version and use the `createMachine` method instead of `Machine`. I also added the inspect mode in order to show how we could use into a next.js app. ## Documentation / Examples - [x] Make sure the linting passes
Hello this PR is in order to update xstate to the lastest version and use the
createMachine
method instead ofMachine
.I also added the inspect mode in order to show how we could use into a next.js app.
Documentation / Examples