TanStackT
TanStack3y ago
3 replies
awake-maroon

Memory leak in SSR

Hi,
I'm using the latest Vue Query plugin with vite-plugin-ssr. As suggested by the docs, the client is created for each request and the cache time is unset, so it defaults to
Infinity
during SSR. Queries are fetched using
suspense
.
I noticed that my app leaked memory on every request so I analyzed some heap dumps and found that there are many Vue Query instances that cannot be garbage collected because there are active subscription listeners (set by Vue Query, not by me).
As a workaround, I do
client.unmount()
at the end of a request which removes those.
Is this a bug or due to wrong usage?
Was this page helpful?