-
Notifications
You must be signed in to change notification settings - Fork 26.1k
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-1287] Docs: Problem of calling a page twice when navigating a page using nextLink #49844
Comments
HI, to better understand the issue you are facing, could you please share the code that you are currently running? The more details you can provide, the easier it will be to find the problem. |
@holicreact Could it be only in development because of the strict mode? Note that components mount, then unmount, and then they mount again when React is in strict mode. This happens only in development. |
@SamarthBagga
@thexpand It's sad but It's working regardless of that. |
Having the same issue here. Can somebody please explain why this is happening? My logging plan exceeded due to this cause. |
@chaepling you too? I hope this problem is resolved soon |
We are also seeing similar issues in production. I have apis on all of my pages, and the apis are going into an infinite cycle due to link prefetch. |
This issue is preventing us from upgrading to v13.4. We have several navigation elements with many links that we can't afford to prefetch them all, so we'd need to set |
@jakepeyser - Could you please tell me what version of NextJS you're using? I'll upgrade my code to the same version and give it a shot. |
@smo043 We're on 13.3.4 in prod |
@jakepeyser - Thank you, I just tried the same thing and encountered the same issue. Check to see if this issue persists for you; I put a console log to my api route and can see it logs continuously which I feel a major problem. |
@smo043 I do not see the issue at our current version, Next.js only seems to prefetch metadata on hover and the new page is rendered and injected on click |
Oh okay, In my case all routes are being prefetched on every page load |
@holicreact - could we change the title of this issue, since many of us have a similar issue? |
@jakepeyser That's right, depending on the specific conditions, both sides have problems.
When prefetch={true}, the development environment fetching mouse hover data. When prefetch={false}, production does not patch the data even if the mouse is hover I think this is related to hard navigation or soft navigation or next13's bug
@smo043 What are you going to change the title to? |
@holicreact - Sorry for not being clear, can we change [docs] to [bug]? |
@smo043 That's a good idea. I'll organize it and post the bug report again |
This PR fixes a few reports that we were double fetching when navigating via a link that had prefetch false. ## Context The bug was happening because we were inadvertently eagerly fetching even if we potentially bailed out of the optimistic navigation, which would then trigger another fetch from going through the regular navigation path. There's potentially another bug here where we should potentially not bail out of optimistic navigation in the cases reported but we can fix that later. fix #49844 link NEXT-1287
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. |
What is the improvement or update you wish to see?
Problem of calling a page twice when navigating a page using nextLink
Is there any context that might help us understand?
If you apply the prefetch={false} option to nextLink, the page is called twice when navigating the page of a sub-dynamic segment of the dynamic segment path.
I am sending additional unnecessary API requests because I make API requests inside the page.
For example, when you have a [categorySlug][subCategorySlug] path, if you browse the categorySlug page, you request the page only once, but when you browse the subCategorySlug path, you request the page twice
If this is a bug, please fix it If it's not a bug, please let me know how to prevent page duplicate calls Thank you.
Does the docs page already exist? Please link to it.
**https://app-directory-v2.vercel.app/context
https://github.com/holicreact/app-directory-v2.git**
From SyncLinear.com | NEXT-1287
The text was updated successfully, but these errors were encountered: