-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow for one-off query overrides for serverside rendering #1290
Conversation
This should help with serverside rendering to allow for things like credential passing on proxied requests.
This helps for serverside rendering implementations, particularly in credential passing.
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at cla@fb.com. Thanks! |
Thanks for the PR. We're open to considering this, but can you provide more detail as to why this is needed and how it would be used? It would be helpful to have a link to examples or docs of how |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
Absolutely, thank you for the prompt response: This issue is closed in isomorphic-relay-router, but a quick read will help explain the issue: denvned/isomorphic-relay-router#13 By exposing this code in relay, and then adding an extra argument for overrides to the prepareData operation in isomorphic-relay-router and isomorphic-relay, we could pass through cookie data to the sendQueries call that these wrap without the overhead of the solution above. |
Ha, on second thought, that issue tracker rambles: |
Making sure CI build passes
I can rebase this pull down to 1 commit if it pans out
Hello, my name is Todd and I'm a huge fan of your codebase! An issue I'm encountering though is due to how the current solution for isomorphic rendering requires modifying the network global via injectNetworkLayer, so I'm pitching this change to the relay team: facebook/relay#1290 Instead of changing our serverside rendering context via injectNetworkLayer and routing queries through a FIFO system, I'd like to pass an overrides object as an additional argument, where fields are provided to modify my request as needed in the network layer. Please weigh in as you feel in both this thread and that one, as I am still getting comfortable with Relay. If this works for everyone though, this should be all that's needed to make server side rendering much cleaner.
Capstone to denvned/isomorphic-relay#43 and facebook/relay#1290 Allows for serverside rendering without a FIFO system
Hey all, after talking with @robrichard, it sounds like my use case was resolved when Relay.environment was able to be used non-globally. |
@toddtarsi Great, I really thought we had already resolved that, glad Relay.Environment is working as intended :-). Thanks for the PR and for following up! |
Absolutely, thanks for the quick responses from everyone. 😄 |
First off, thank you guys for making this. This codebase is really awesome, and I love the approach to everything. Currently though, the main known open source serverside rendering solution (isomorphic-relay, another great codebase) is kind of in a bad spot when it comes to credential passing.
An example of this can be seen with isomorphic-relay, where the solution for passing httponly cookies in serverside rendering involves converting the endpoint to run sequentially, which is a major deoptimizer. By exposing overrides like this, we could skirt that approach by instead just passing in one off data into the sendQueries call.
Admittedly, I don't know this codebase all too well, and there are probably a lot of gotchas I'm overlooking, but I wanted to put this out there and just see what your guys thoughts were. Also, if you just want to see more polish and consistency, let me know and I can refactor / rebase this as needed.
Thanks as always!