remix
remix copied to clipboard
single-fetch `useLoaderData()` evaluates to `null` when redirecting to same URL when `shouldRevalidate` returns false
Reproduction
https://stackblitz.com/edit/remix-run-remix-is4wn4
- Start on home page
- Click on "Go to subpage" (should navigate to and open
/subroute
) - Click on "Home". (should navigate to and open index/root
/
route again) - Click on "Go to subpage" again. (should see error in screenshot below)
The error happens when the following conditions are true:
- Child route loader throws a
redirect
- Child route has a
shouldRevalidate
function defined (and potentially returnsfalse
)
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