Persistent data between sessions in dev mode #2086
-
So I see that in development mode, data does not persist at all like it would in production mode. // data.ts
export let count = 0;
// page.tsx
import { count } from "./data";
export function loader() {
count++;
console.log(count);
}
I know this is probably intended behaviour since developer mode is supposed to be "cacheless" but is there a way around this (aka persist data between development mode sessions)? Reconnecting to the database on every request makes it very slow and annoying to deal with. You also cannot cache any user sessions (unless you can with the built-in session structure but I find it very confusing and over-complicated for my use case with all due respect). Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
You can store in |
Beta Was this translation helpful? Give feedback.
You can store in
global
anything that you want to persists.