I have some questions about the request lifecycle in middleware #14549
-
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
I think the example is wrong, as you noticed, the POST request the triggers the action and then followed by a separate GET request, each request has its own router context instance making it impossible to share a value between them. However, this is true if the POST request was also a document request, in which case the same POST triggers the loaders, allowing the sharing of the router context instance. I think the example needs to be updated to mention that only works for document requests, cc @brookslybrand |
Beta Was this translation helpful? Give feedback.
yeah - on the server context is request-scoped so on document requests you can share but on SPA navigation requests you cannot.
On the client (clientMiddleware, clientLoader, clientAction), because there no HTTP request - you can always share context
I'll push up an update 👍