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

Crazy random full page reloads when combining app dir and pages dir #49154

Closed
1 task done
klarstrup opened this issue May 3, 2023 · 9 comments
Closed
1 task done

Crazy random full page reloads when combining app dir and pages dir #49154

klarstrup opened this issue May 3, 2023 · 9 comments
Labels
bug Issue was opened via the bug report template. Navigation Related to Next.js linking (e.g., <Link>) and navigation.

Comments

@klarstrup
Copy link

klarstrup commented May 3, 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: arm64
      Version: Darwin Kernel Version 22.3.0: Thu Jan  5 20:48:54 PST 2023; root:xnu-8792.81.2~2/RELEASE_ARM64_T6000
    Binaries:
      Node: 18.15.0
      npm: 9.5.0
      Yarn: 1.22.19
      pnpm: 8.3.1
    Relevant packages:
      next: 13.4.3-canary.1
      eslint-config-next: N/A
      react: 18.2.0
      react-dom: 18.2.0
      typescript: N/A

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://github.com/klarstrup/next.js-repro-repo/tree/random-hard-navigation

To Reproduce

Enable appDir and have a static page in /app as well as a route in /pages with a dynamic and a catchall segment.

The repro includes an example for iterating through combinations of catch all segment values at http://localhost:3000/dynamic-part/7/1

Describe the Bug

What should be client-side soft navigations become hard page loads at seemingly randomly URLs like Router.replace("/dynamic-part/7/2") and Router.replace("/dynamic-part/7/3"), but not adjacent URLs on the same route such as Router.replace("/dynamic-part/7/1") and Router.replace("/dynamic-part/7/4")

Expected Behavior

Router.replace("/dynamic-part/7/2") and Router.replace("/dynamic-part/7/3") should behave just as Router.replace("/dynamic-part/7/1") and Router.replace("/dynamic-part/7/4") do, with a fully client-side navigation without a page reload.

@klarstrup klarstrup added the bug Issue was opened via the bug report template. label May 3, 2023
@github-actions github-actions bot added area: app Navigation Related to Next.js linking (e.g., <Link>) and navigation. labels May 3, 2023
@klarstrup
Copy link
Author

No, this bug does not happen without the static and unused /app/ping/page.js page.

Yes it only happens for specific combinations of catch all segment values.

@klarstrup
Copy link
Author

Probably related to the 2% warned here #46283

But should this come into play at all for a navigation within the exact same route?

@klarstrup
Copy link
Author

Remains relevant as of 13.4.0

@klarstrup
Copy link
Author

Remains relevant as of 13.4.1

@klarstrup
Copy link
Author

Remains relevant as of 13.4.2 and 13.4.3-canary.0

@klarstrup
Copy link
Author

This reproduction seems to have been fixed as of 13.4.3-canary.1, owing to #49741 I suppose

@klarstrup
Copy link
Author

Will reopen this if I happen upon it in the real world again, but this repro seems to have gone the way of the dodo.

@ijjk
Copy link
Member

ijjk commented May 18, 2023

Closing per #49154 (comment) as sounds like this is corrected now, let us know if you are still seeing issues with this after that patch!

@ijjk ijjk closed this as completed May 18, 2023
@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 Jun 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. Navigation Related to Next.js linking (e.g., <Link>) and navigation.
Projects
None yet
Development

No branches or pull requests

2 participants