Server module is executed multiple times
Unanswered
Lê Duy Quang posted this in #help-forum
Somehow if I'm having an
Like I see the module getting executed at least thrice: when the page loads, when an API route is called and when a server action is executed.
What I've read suggests the module should be executed only once in each environment, but that turns out to be not the case. There is also this old issue https://github.com/vercel/next.js/issues/55885 but no answers were given there either.
export const in a module that is used only on server side, the module code is executed more than once, creating multiple instances of that variable?Like I see the module getting executed at least thrice: when the page loads, when an API route is called and when a server action is executed.
What I've read suggests the module should be executed only once in each environment, but that turns out to be not the case. There is also this old issue https://github.com/vercel/next.js/issues/55885 but no answers were given there either.