Next.js Discord

Discord Forum

shared const changes persisted in memory between renders

Unanswered
Scottish Fold posted this in #help-forum
Open in Discord
Scottish FoldOP
I noticed that in dev mode, if I declare an object instance with const inside lib, like an array, then I push an item to it, the change will persist even with reloads, even in different browsers, even if the page is using cookies() or noStore()...

It's caching the object, Is this behavior expected?

I also noticed this behavior happening after build

0 Replies