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

single-fetch useLoaderData() evaluates to null when redirecting to same URL when shouldRevalidate returns false #9906

Closed
sapter opened this issue Aug 22, 2024 · 2 comments

Comments

@sapter
Copy link

sapter commented Aug 22, 2024

Reproduction

https://stackblitz.com/edit/remix-run-remix-is4wn4

  1. Start on home page
  2. Click on "Go to subpage" (should navigate to and open /subroute)
  3. Click on "Home". (should navigate to and open index/root / route again)
  4. Click on "Go to subpage" again. (should see error in screenshot below)

The error happens when the following conditions are true:

  1. Child route loader throws a redirect
  2. Child route has a shouldRevalidate function defined (and potentially returns false)

System Info

System:
    OS: macOS 14.5
    CPU: (8) arm64 Apple M1
    Memory: 65.55 MB / 8.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.5.1 - /opt/homebrew/bin/node
    Yarn: 1.22.11 - /usr/local/bin/yarn
    npm: 10.8.2 - /opt/homebrew/bin/npm
    pnpm: 8.15.4 - ~/Library/pnpm/pnpm
    bun: 1.0.14 - ~/.bun/bin/bun
  Browsers:
    Chrome: 127.0.6533.120
    Edge: 127.0.2651.105
    Safari: 17.5

Used Package Manager

npm

Expected Behavior

useLoaderData is not null

Actual Behavior

useLoaderData is null
image

@brophdawg11
Copy link
Contributor

This looks like it's because the _routes param is sticking around unintentionally. I'll get a fix in for that but in the meantime I think you could workaround it if you deleted that from the redirect URL you are constructing.

@brophdawg11
Copy link
Contributor

This was resolved in 2.12.0 via #9938

@brophdawg11 brophdawg11 removed their assignment Sep 13, 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

2 participants