netlify/next-runtime

[Bug]: React Context not persisting across client side page transitions. App router.

ehowey opened this issue · 4 comments

Summary

Hello!

I am running into an issue with React Context not persisting properly across page transitions when using the app router. It works in local dev, works on Vercel, but the context/state is resetting on each page transition with Netlify. Note this bug is only present when deployed, so tricky to debug and fix. The minimal reproduction is below.

Site on Netlify: https://nextjs-netlify-context-bug.netlify.app/
Site on Vercel: https://nextjs-netlify-context-bug.vercel.app/

A link to a reproduction repository

https://github.com/ehowey/context-bug

Expected Result

React context works properly and state is persisted across page transitions.

Actual Result

React context is resetting state on page transitions

Steps to reproduce

  1. Clone repo
  2. Deploy to Netlify

Next Runtime version

4.41.3

Is your issue related to the app directory?

  • Yes, I am using the app directory

Build information

I used all of the default build settings and let Netlify autodetect NextJs.

This looks like it's a result of this bug #2089 to me. I see a full page reload happening when navigating between pages on Netlify but not on Vercel.

Yep that looks like it to me too. I'm surprised this isn't taking a bigger focus as it seems like a fairly major issue.

We are experiencing the same thing, is there any chance of this being fixed any time soon?