app router - Aiming for smooth SPA behaviour in Next.js, but navigating back to previous Pages causes full page refresh - Stack

I have a Page 1 (Search Page) that contains links to Product 1 and Product 2 (Page 2).Currently, I’m u

I have a Page 1 (Search Page) that contains links to Product 1 and Product 2 (Page 2).

Currently, I’m using the default prefetching behavior (prefetch={undefined} or null) for the links to Page 2. There’s also a back button on Page 2 that should return the user to Page 1 without reloading it. While this works correctly with router.back(), I’ve noticed an issue on iPhone devices:

after navigating back and forth multiple times—specifically, from Page 1 to Page 2, then back to Page 1, and finally to a different product (Page 2) before returning to Page 1 again—on the fifth load of the Search Page (Page 1), it performs a full-page refresh.

This results in a broken user experience.

I suspect that this issue may be related to memory constraints due to router caching, which could be exceeded and causing the page to refresh.

Do you have any suggestions? If you need any further adjustments or specific details added, just let me know!

Next.js version: 13.4.12

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742316780a4420995.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信