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

[NEXT-1020] Parallel Route Navigation fails with prefetch set to false #48122

Closed
1 task done
dalalmj opened this issue Apr 8, 2023 · 1 comment · Fixed by #48449
Closed
1 task done

[NEXT-1020] Parallel Route Navigation fails with prefetch set to false #48122

dalalmj opened this issue Apr 8, 2023 · 1 comment · Fixed by #48449
Assignees
Labels
bug Issue was opened via the bug report template. linear: next Confirmed issue that is tracked by the Next.js team.

Comments

@dalalmj
Copy link

dalalmj commented Apr 8, 2023

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
      Platform: darwin
      Arch: x64
      Version: Darwin Kernel Version 22.3.0: Mon Jan 30 20:42:11 PST 2023; root:xnu-8792.81.3~2/RELEASE_X86_64
    Binaries:
      Node: 16.17.0
      npm: 9.1.3
      Yarn: 1.22.18
      pnpm: N/A
    Relevant packages:
      next: 13.3.1-canary.3
      eslint-config-next: N/A
      react: 18.2.0
      react-dom: 18.2.0

Which area(s) of Next.js are affected? (leave empty if unsure)

No response

Link to the code that reproduces this issue

https://github.com/dalalmj/prtest

To Reproduce

Using parallel route to display list detail view. List = base route. Detail = @detail, parallel route. This allows user to see list while getting details either in modal or below or to right of list. Parallel route feature works when Link does not have any prefetch. But if you set prefetch to false then whole thing fails (even for link that does not have prefetch)

  1. Run, click List link.
  2. Click on Works when prefetch=true (default), see detail below list Detail Id 2
  3. Back on Browser (or refresh)
  4. Click on Does Not Works with prefetch=false, no details shown

Describe the Bug

When prefetch is set to false, navigation to parallel route fails.

Expected Behavior

When prefetch is set to false, navigation to parallel route should work!

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

NEXT-1020

@dalalmj dalalmj added the bug Issue was opened via the bug report template. label Apr 8, 2023
@feedthejim feedthejim added the linear: next Confirmed issue that is tracked by the Next.js team. label Apr 16, 2023
@feedthejim feedthejim changed the title Parallel Route Navigation fails with prefetch set to false [NEXT-1020] Parallel Route Navigation fails with prefetch set to false Apr 16, 2023
@feedthejim feedthejim assigned feedthejim and unassigned feedthejim Apr 16, 2023
feedthejim added a commit that referenced this issue Apr 17, 2023
…e parallel routes (#48449)

This PR fixes parallel routes navigation with `prefetch={false}`. This
was broken because the optimistic tree created when navigating with
prefetching disabled resulted in a state where the router tree was
expecting an incorrect node to be rendered and suspended until the
imaginary data arrived.

The fix consists of updating the method that creates the optimistic tree
in order to bailout of the optimistic tree creation when there are
multiple parallel routes for the current node.

<!-- 

## For Contributors

### Improving Documentation or adding/fixing Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md



## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->

fix #48122
link NEXT-1020

---------

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
@github-actions
Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template. linear: next Confirmed issue that is tracked by the Next.js team.
Projects
None yet
2 participants