router icon indicating copy to clipboard operation
router copied to clipboard

Preloaders affecting current route

Open CamBurris opened this issue 1 year ago • 1 comments

Describe the bug

Preloading of routes seems to be affecting the currently rendered route. In the codesandbox, there are two routes under an _auth layout route. The _auth.tsx conditionally returns notFound() for the /notFound route and otherwise renders the route.

When you first load the /notFound route, the not found component is rendered as expected. When you hover over the link to /test, you will see the component for the /notFound route is rendered instead of the not found component.

Your Example Website or App

https://codesandbox.io/p/devbox/preload-d7l47f?file=%2Fsrc%2Froutes%2F_auth.tsx%3A9%2C3

Steps to Reproduce the Bug or Issue

  1. Go to /notFound page.
  2. Should see the not found component being rendered as expected.
  3. Hover over the Test route link in the header.
  4. You will see the component for /notFound is rendered instead of the not found component.

Expected behavior

Preloading other routes should not affect the current route.

Screenshots or Videos

No response

Platform

  • OS: macos
  • Browser: Chrome
  • Version: 124

Additional context

No response

CamBurris avatar May 09 '24 18:05 CamBurris

do you know which version introduced this issue?

schiller-manuel avatar May 09 '24 20:05 schiller-manuel

Retested the reproduction using 1.52.0 and this issue has been fixed.

https://codesandbox.io/p/devbox/preload-forked-ygvgjq

SeanCassiere avatar Aug 31 '24 22:08 SeanCassiere