You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have wrapped a context around _app and it looses it's state when I navigate back (via browser or <Link /> (at least I think that is the problem, might be introduced with #19006, but I'm also not 100% sure)
constList=({ items =[]})=>{// initial state comes from the parent componentconstcontext=useContext(ListContext);functionloadMoreFn(){context.addFn([makeId(6),makeId(6),makeId(6),makeId(6)]);// just faking additional random data }return(<><divclassName={styles.grid}>{items.concat(context.items).map((item)=>(// yes, could also be done with useEffect and useState, but for simplicity <Linkhref={`/detail/${item}`}key={item}><aclassName={styles.card}><h3>{item} →</h3></a></Link>))}</div><buttononClick={loadMoreFn}>Load more</button></>);};
wiesson
changed the title
_app context loses state when navigating back (looks like vercel only)
_app context loses state when navigating back (looks like vercel only, 10.0.2^18)
Nov 17, 2020
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.
vercel
locked as resolved and limited conversation to collaborators
Jan 29, 2022
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Bug report
Describe the bug
I have wrapped a context around
_app
and it looses it's state when I navigate back (via browser or<Link />
(at least I think that is the problem, might be introduced with #19006, but I'm also not 100% sure)_app.js
Usage in List Component
To Reproduce
Repo - https://github.com/wiesson/next-testing
Basic demo - https://next-testing-six.vercel.app
Expected behavior
The state should not be cleared and it worked well before 10.0.2. It does not happen locally (
next start
), but on Vercel.Screenshots
If applicable, add screenshots to help explain your problem.
System information
The text was updated successfully, but these errors were encountered: