Invalidate context
Hey guys ! 👋
I think i'm missing something on how to properly invalidate the root context.
I created a router with a context like this :
So every time i use
useRouter().invalidate() i'm expecting the value of establishmentId to be recomputed ?
It doesn't seem to be the case because even if i update the cookie, the value does not change.
I tried to log the value of establishmentId by using a self called function and it seems to be only called once
Am i missing something about context (or maybe it's the cookie usage)2 Replies
conscious-sapphire•6mo ago
you would need to put this into e.g. root's beforeLoad and return it from there
the context you pass into createRouter is static
exotic-emeraldOP•6mo ago
Yep it's working just fine like this 🙂 Thank a lot for the quick answer !