Wholteza
Wholteza
NNuxt
Created by Wholteza on 9/3/2024 in #❓・help
Share state between server route and SSR context
Unfortunately this would mean that we'd have to perform this check pretty often (for each non-edge-cached SSR result), and since it would be render-blocking i would like to avoid it. We're running this application at scale with a lot of users so each request counts.
10 replies
NNuxt
Created by Wholteza on 9/3/2024 in #❓・help
Share state between server route and SSR context
There's a clear question stated about sharing state between a server route and a request to SSR a page. Lets keep it to that.
10 replies
NNuxt
Created by Wholteza on 9/3/2024 in #❓・help
Share state between server route and SSR context
What package this is and why the maintainer has chosen not to support using it in server routes is really an implementation detail that isn't relevant to my issue at hand, other than the fact that it isn't supported.
10 replies
NNuxt
Created by Wholteza on 9/3/2024 in #❓・help
Share state between server route and SSR context
However this isn't very clean and we'd like to separate our service integration flow from our users if possible.
10 replies
NNuxt
Created by Wholteza on 9/3/2024 in #❓・help
Share state between server route and SSR context
What we managed to implement was a view route using a page that is never going to be accessed by a user pages/purge.ts. In the routing middleware we check if we're on the server during an SSR request. Then we use the private runtime config to validate the request signature and purge the servers 3pp's cache.
10 replies
NNuxt
Created by Wholteza on 9/3/2024 in #❓・help
Share state between server route and SSR context
In this case a 3pp has decided to use an in-memory cache that we have to purge using a webhook. Our plan was to use a server route "/api/purge" to run the 3pp's built in purge method. But it turned out that there was no support for running that 3pp hook in a server route. So our next idea was to set some kind of state from the server route that could be read by our SSR routing middleware and call for the purging of the cache from there, then reset the state flag. The sharing of state is what we cannot figure out. So right now the "where" is a nuxt route middleware.
10 replies