Replies: 1 comment
-
My bad, I guess this is a similar discussion to this one, I only checked the issues. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I noticed that the
loadContext
isn't accessible in the server tohandleDocumentRequestFunction
which corresponds to the build entry module, This can help to provide an execution context for the current request (for example, to do own implementation of thread locals which can help in dependency injection and also reduce global clashes and thread safety in the server).Why ?
In the userland, and with the many ways JS apps can be written (globals usage, no multi-threaded context), there are use cases where a
stable
reference identity accessible all over the "entries" is important to:principal
For example, all frontend libraries (without being specific about names) relying on globals or 'not compatible' with SSR can be easily adapted with this, to attach an accessible (their problem) reference that would just allow them to have a "request" scope, and everyone is happy.
Feature request
While searching for the stable reference in the remix backend, I first tried the
request
object passed by loaders and build entry, but noticed that the reference isn't the same, then followed it tocallRouteLoaderRR
where it is cloned (stripped).Then, I tried the
loadContext
that also get swallowed instaticHandler.query()
, but it makes it to thehandleDocumentRequestRR
, so may be we can provide this as auser-specific
rather than opting forrequest
object stability.The feature request is like providing to the
loadContext
to the user wherever they need it.I only got to pass through this execution stack, so maybe there are other paths where this won't apply ? Or there is any design model that prevent this context from being passed ?
If you are okay with this, I may then try to work on it if it isn't included in your roadmap or you are on a tight schedule.
Thanks again for bringing remix to us guys 🙏
Context (maybe irrelevant)
I have written lot of apps from the old days (php, ejb, struts, ...) and actively also using the spring-boot ecosystem, so it is sort of things that I had (project implementation always differ) for granted, being able to inject context specific things and implementations while being thread safe. I also was actively writing javascript and react apps for the last 5 years. I just got to use remix (although, i was a fan since the video that got deleted from youtube, the very first one about remix) to build some stuff, and this feature is what I wish the most. It will just allow me to use all the power of remix, while being able to use isolated contexts.
Beta Was this translation helpful? Give feedback.
All reactions