remix-run / react-router

Declarative routing for React
https://reactrouter.com
MIT License
52.5k stars 10.19k forks source link

🗺 Loader+Action Context (Middleware) #9566

Closed ryanflorence closed 1 year ago

ryanflorence commented 1 year ago

Progress

tigerabrodi commented 1 year ago

This is exciting! 🔥

kentcdodds commented 1 year ago

This will be super helpful so I can ditch express and just rely on remix-serve 🔥

My specific use case includes auth (of course), but also I'm working on implementing this: https://fly.io/docs/litefs/files/#using-txid-to-handle-consistency

So, basically, when a user makes a mutation in a non-primary region, I need to force them to wait until that data has been propagated to their region before they can read their local db.

Things get kinda funny when you distribute your data, but want to make sure there's consistency as well as availability & partition tolerance (pick two, add one 😅).

tigerabrodi commented 1 year ago

Nice! 😄

Our use case also includes auth, getting the user through the context, in both the actions and loaders. 🔥

AMoktar commented 1 year ago

Thanks guys, you are the best 👍

runarj commented 1 year ago

Great work!

I am unsure if this is relevant, but how will beforeLoader traverse the route hierarchy? If you, for example, choose a "Pre-order Traversal," are you sure it will fit all future uses of the hook?

Also, would it be better to add this as a plugin so that projects could add additional hooks themselves? I guess that this will make things too complicated, but I could be wrong.

ryanflorence commented 1 year ago

@jacob-ebey and @brophdawg11 to try to wrap up the adapter/bundling questions, then bring in @ryanflorence and @mjackson for an API review

brophdawg11 commented 1 year ago

Closing this temporarily since we put this on hold while we finalize Remix v2. This is early on the roadmap once v2 is out so will re-open then.