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

revalidatePath redirects to intercepting route #54085

Closed
1 task done
maxhannan opened this issue Aug 16, 2023 · 7 comments
Closed
1 task done

revalidatePath redirects to intercepting route #54085

maxhannan opened this issue Aug 16, 2023 · 7 comments
Labels
bug Issue was opened via the bug report template. locked

Comments

@maxhannan
Copy link

maxhannan commented Aug 16, 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.4.0: Mon Mar  6 21:01:02 PST 2023; root:xnu-8796.101.5~3/RELEASE_ARM64_T8112
    Binaries:
      Node: 20.4.0
      npm: 9.7.2
      Yarn: N/A
      pnpm: N/A
    Relevant Packages:
      next: 13.4.12
      eslint-config-next: 13.4.12
      react: 18.2.0
      react-dom: 18.2.0
      typescript: 5.1.6
    Next.js Config:
      output: N/A

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

App Router

Link to the code that reproduces this issue or a replay of the bug

https://app.replay.io/recording/create-next-app--71effefe-43de-463e-b54e-4c2e3d2fa540

To Reproduce

Create a dynamic route which uses a server action to mutate data. Create a parallel, intercepting route which displays the same page in a modal and has the same ability to mutate data. When using a server action that revalidates path on the actual route, when the route is revalidated you will be redirected to intercepting route.

Describe the Bug

I have a route '/post/[id]' which also uses and intercepting parallel route to display the same page in a modal above the home page. On this page there is a like button which uses server actions to mutate the database which then calls revalidate route after the mutation is completed. On the intercepted route, this works without issue, however if I click the like button on the full route (not intercepted) when revalidatePath is called, the page redirects and the intercepting route modal is rendered over the full route (see recording). I am also using 'useOptimistic) but this bug occurs with or without the use of that hook.

Expected Behavior

revalidatePath does not redirect and show the intercepting route on top of the full route page.

Which browser are you using? (if relevant)

Chrome Version 115.0.5790.170 (Official Build) (arm64)

How are you deploying your application? (if relevant)

Vercel

@maxhannan maxhannan added the bug Issue was opened via the bug report template. label Aug 16, 2023
@eharvey328
Copy link

I'm having the same issue. This can also be observed during a hot reload of the nextgram example app.

@maxhannan have you found any workaround since opening this?

@crowmw
Copy link

crowmw commented Oct 31, 2023

Same problem for me. This is unfortunate because this is a common scenario where we have a form in a modal after which we close the modal, for example.

next.js 14.0.1 not fixed yet

@chris-trait
Copy link

This is affecting me too in 14.0.1.

Calling revalidateTag from inside a server action triggered by an intercepted route (either the original route, or the intercepted version), causes a page reload... the action never returns and the rest of my client function never runs.

@rperrote
Copy link

next.js 14.0.3 not fixed yet

@balazsorban44
Copy link
Member

Hi, the provided reproduction is missing the source code, and nextgram does not use revalidatePath either. To investigate, we need the source code. Please open a new issue with a minimal reproduction, thanks! "same issue", "not fixed" comments are unfortunately unhelpful in the investigation. 🙏

@kahnclusions
Copy link

Hi @balazsorban44 I've opened a new issue with a reproduction using NextGram here: #59796

Copy link
Contributor

github-actions bot commented Jan 3, 2024

This closed issue has been automatically locked because it had no new activity for 2 weeks. 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 added the locked label Jan 3, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 3, 2024
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. locked
Projects
None yet
Development

No branches or pull requests

7 participants