Skip to content

<Link prefetch={false}> in multiple root layouts just fetch, no transition #48530

@wonu

Description

@wonu

Verify canary release

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

Provide environment information

Operating System:
      Platform: linux
      Arch: x64
      Version: Ubuntu 20.04.0 LTS Tue Apr 18 2023 19:37:14 GMT+0900
    Binaries:
      Node: 16.14.2
      npm: 7.17.0
      Yarn: 1.22.19
      pnpm: 8.2.0
    Relevant packages:
      next: 13.3.1-canary.12
      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)

App directory (appDir: true), Routing (next/router, next/navigation, next/link)

Link to the code that reproduces this issue

https://stackblitz.com/edit/vercel-next-js-8g3pxu

To Reproduce

  1. Group routes with root layout, like multiple root layouts.
app
└── (group)
    ├── bar
    │   └── page.tsx
    ├── foo
    │   └── page.tsx
    ├── layout.tsx
    └── page.tsx
  1. Click <Link href='/foo'>go to /foo</Link>, then page moves to /foo.
  2. Click <Link href='/bar' prefetch={false}>go to /bar</Link>, then only fetch /bar, no page move.
  3. And once that happened, clicking foo does the same thing as bar.

Describe the Bug

Clicking <Link> doesn't work as expected as above.

Expected Behavior

Clicking <Link> should make page transition, not just fetching.

If add root layout outside of route group or allow prefetch then the issue is not be reproduced.

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Linking and NavigatingRelated to Next.js linking (e.g., <Link>) and navigation.bugIssue was opened via the bug report template.locked

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions