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

Changing routes quickly sometimes leads to errors finding routes #7080

Closed
1 task done
kentcdodds opened this issue Aug 5, 2023 · 6 comments
Closed
1 task done

Changing routes quickly sometimes leads to errors finding routes #7080

kentcdodds opened this issue Aug 5, 2023 · 6 comments

Comments

@kentcdodds
Copy link
Member

What version of Remix are you using?

1.19.2

Are all your remix dependencies & dev-dependencies using the same version?

  • Yes

Steps to Reproduce

Got this from kentcdodds/kentcdodds.com#473

  1. go to blog page
  2. Open useEffect vs useLayoutEffect article
  3. scroll down and open visit course link
  4. go back in browser history very quickly (click twice quickly on the go back button)
  5. you should find yourself in the blog page
  6. instead error appears

Expected Behavior

The /blog route should be shown

Actual Behavior

You get an error (I have an error boundary but it's not shown):

TypeError: Cannot read properties of undefined (reading 'links')
    at https://kentcdodds.com/build/_shared/chunk-NA3JZD7E.js:9:330
    at Array.map (<anonymous>)
    at _n (https://kentcdodds.com/build/_shared/chunk-NA3JZD7E.js:9:284)
    at https://kentcdodds.com/build/_shared/chunk-NA3JZD7E.js:14:2535
    at Object.useMemo (https://kentcdodds.com/build/_shared/chunk-Y6UZ2JHA.js:6:25719)
    at r.useMemo (https://kentcdodds.com/build/_shared/chunk-52ROR7N5.js:1:6137)
    at Qo (https://kentcdodds.com/build/_shared/chunk-NA3JZD7E.js:14:2523)
    at du (https://kentcdodds.com/build/_shared/chunk-Y6UZ2JHA.js:6:19466)
    at Ba (https://kentcdodds.com/build/_shared/chunk-Y6UZ2JHA.js:8:43659)
    at Ua (https://kentcdodds.com/build/_shared/chunk-Y6UZ2JHA.js:8:39459)

6 total relevant errors appear in the console
image
image

@hichemfantar
Copy link

I just wanted to mention that this doesn't always happen, even when quickly switching routes.
It may be some kind of race condition.

@brophdawg11 brophdawg11 self-assigned this Aug 7, 2023
@brophdawg11
Copy link
Contributor

@kentcdodds are you sure you're on 1.19.2? I'm seeing 1.17.1 in the sourcemaps and also in the preserved comments at the bottom of the bundles files: https://kentcdodds.com/build/_shared/chunk-NA3JZD7E.js

Screenshot 2023-08-21 at 4 11 47 PM Screenshot 2023-08-21 at 4 13 40 PM

This sounds like #1757 which was fixed in 1.18.0, so if you are on 1.17.1 this would make sense showing up on these fast back button navigations. The underlying issue is described in more detail here and the fix we went with was just trying to detect this URL mismatch and doing a browser reload.

@kentcdodds
Copy link
Member Author

Oh man, I apologize for my lazy issue filing 🤦‍♂️ I can't remember my state of mind when I opened this issue, but I apologize for not double-checking that I was upgraded before opening this. Sorry for the wild goose chase. Thank you for fixing it!

I've just upgraded (thanks for npx upgrade-remix!!) and it's now extremely difficult to reproduce this issue. I have to hit forward/backward in random orders over and over again very rapidly to have it show up. I'm not sure what could be causing this, but like I said, it's very difficult to reproduce and users won't be behaving this way normally so I think this is safe to close, but I'll leave that to you.

@brophdawg11
Copy link
Contributor

Well drat - I wish "extremely difficult" was instead "impossible" 😂 , so I guess there's still some path that can hit it. I'll keep it open for now but won't put it high on the priority list since if it does happen a simple refresh oughta get the user back to a working state.

I have a small hope/hunch that #7133 might allow us to fix this in a better manner without the forced reload since we could rely on lazy to load the modules for the new URL - and just delay hydration. I'll loop back and see if that helps once we land that.

@anthonymartinovic-eiq
Copy link

Are there any updates for this issue? We're currently running on version 2.1.0 and are dealing with the same error for one particular route.

Unfortunately I've been unable to find a consistent way to reproduce this error, it's happening seemingly at random.

@brophdawg11
Copy link
Contributor

Please see details in #1757 (comment) but we think this is no longer an issue in current versions of Remix so I'm going to close it out. Please re-open with reproduction steps if anyone comes across this again!

@brophdawg11 brophdawg11 removed their assignment Aug 20, 2024
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

4 participants