remix icon indicating copy to clipboard operation
remix copied to clipboard

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

Open sapter opened this issue 6 months ago • 1 comments

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

sapter avatar Aug 22 '24 18:08 sapter