Query client on SSR memory
Does anyone know if this
Would create a new object in nextJS for each session? on a standard react app that object would be created each time a component renders. Wasn't sure for next as this is app component. Anyone know?
9 Replies
sunny-green•3y ago
Why would it be created on each render? It's inside the useState lazy initializer function...
quickest-silverOP•3y ago
just that if you have
in a component then it forces a re render?
ah i see
totally different
Gunna share some interesting thihngs with cacheTime soon. We had big issues with node garbage collection and running out of memory on a big app
changed the cacheTime to infinity on the server
the CPU time dropped like a stone!
thanks @TkDodo 🔮 !
sunny-green•3y ago
we've fixed this in v4. I guess you're on v3 ?
quickest-silverOP•3y ago
yep. indeed. Set a set infinity cache time on the server
quickest-silverOP•3y ago
before

quickest-silverOP•3y ago
after
quickest-silverOP•3y ago

sunny-green•3y ago
Infinity is the default in v4 🙂
good to see that it helped
quickest-silverOP•3y ago
yup.. read that in some github issues you were in
using react query for a very large uk gov contract