Running middleware before a bunch of parallel requests
In Remix a bunch of request handlers are ran in parallel which causes problems for refreshing tokens - if your token expires and you call N handlers then each of them will try to refresh the token causing the previous tokens to be invalidated leaving the user in a horrible state. A normal approach would be to add some middleware to run before any of these handlers are invoked but this isn't quite possible in Remix today (it is coming though).
I have a custom runtime so I was wondering what I could do to perhaps make my own middleware to run before the group of loaders are invoked. I basically have N parallel requests that need to wait for some code to run before they can then proceed to run in parallel. Is there something in the Effect ecosystem that can help me here?