Skip to content
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 not working with next/link #1702

Closed
osequi opened this issue Dec 7, 2020 · 4 comments
Closed

XState not working with next/link #1702

osequi opened this issue Dec 7, 2020 · 4 comments

Comments

@osequi
Copy link

osequi commented Dec 7, 2020

Description
I have a simple application using xstate, react-responsive and next/link. It renders different content on different viewports and different routes.

Expected Result
When navigating from a page to another via links the app should work fine.

Actual Result
When navigating via links the app doesn't work fine, the state seems not to be updated well. When navigating with the browser's arrows all works fine.

Reproduction
https://codesandbox.io/s/prod-butterfly-mbtbm

Additional context
See #995 (comment)

@davidkpiano
Copy link
Member

@osequi I can't reproduce this. Clicking the links works fine, as does using browser navigation.

Can you please provide specific steps showing what is broken, and more importantly, showing exactly how it is related to XState (if it is, at all)?

@osequi
Copy link
Author

osequi commented Dec 7, 2020

I don't know if it is related to XState, for now. I've recreated the example with Create React App / React Router and the problem persists. Give me a little time and I'll get back to you.

@davidkpiano
Copy link
Member

Okay, thanks. Just for cleanup, let's reopen this issue if we can verify that it is in fact an XState issue.

@osequi
Copy link
Author

osequi commented Dec 7, 2020

Right, I can confirm the problem was in my XState declarations. It turns out I need transient states and guards, not just simple child states.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants