-
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
Expose sourceHash or id for operations #2747
Comments
The What we do at facebook is to have the |
Implement Please consider the possibility for small change in
I do believe that might be possible use the logic in this block with small tweak to expose it in the
I think that adding this |
I’m planning on using a persist function as per @kassens’ description in the future, so for now we simply fetch the query text from the persisted query map https://github.com/artsy/emission/blob/758258699f78db09513b61a321c6099a5c15ee07/src/lib/relay/middlewares/cacheMiddleware.ts#L25 |
The problem with this approach is that "all" the queries get bundled into the app, even that removed by tree-shacking. I might monkey patch the relay-compiler with 2 lines of code to: Nowadays if we "persist" then we get just the
I would like to have both. Why? We manage different strategies to deal with server persistence, but for simplicity imagine that the GQL client send cc @josephsavona How do you see to introduce a flag to choose the |
@jstejada Do you think that explained above might be possible expose both I will appreciate any hint, thanks. |
Hey, it there something preventing adding ID every-time ? (and keep the behavior of nulling the text with the persisted option) |
Our flow is: send to the server In this moment the compiler logic is: if it is a persisted query, then just give back the The required change is just add @josephsavona @kassens Could you please evaluate the feasibility of this change? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Is there anything new with about this with the relay-compiler beeing moved to rust? Thanks 🙏 |
I think it's now the case , we can access the operation.id... unfortunately we can't change the algorithm yet without using persisting queries file |
fetchQuery
receivesoperation.node.params
but it would be nice to have access tooperation.node.hash
to use it for local cache key and mainly for the following approach: first fetch to the server with hash and variables only, if the server contains the hash in its own cache, it directly responds, else a second round trip with query, variables and hash will be done.relay/packages/relay-runtime/store/RelayModernEnvironment.js
Line 274 in b783255
relay/packages/relay-compiler/language/javascript/formatGeneratedModule.js
Line 45 in 4343e80
Other possibility could be using something similar to "persist-output", but this removes the text of the operation, we need to keep the
text
and get also theid
to use this one as hash.@josephsavona Do you have some hint? is this doable? willing to work in a PR if it makes sense for you.
The text was updated successfully, but these errors were encountered: