You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The reason for this is that we've passed a custom query option to the buildGraphQLProvider function. This query function populates some custom context like so:
We then use this context in ApolloLink.split() to determine what endpoint to route a given request to.
Other information:
I realize that this might be a niche use-case. However, I think the problem would be easily avoidable via one of the following:
checking of any context was generated from the query function and, if so merging it with the new fetchOptions context.
specify the custom context above the ...getOptions(otherOptions.query, raFetchMethod, resource), call and leave it to the end user to deal with (e.g. force them to pass that option in their context.
I'll also add that I'm happy to submit a PR if the maintainers approve.
Environment
React-admin version: 5.0.3
Last version that did not exhibit the issue (if applicable): 4.16.19.
React version: ^18.3.0
Browser: Brave
Stack trace (in case of a JS error): N/A
The text was updated successfully, but these errors were encountered:
What you were expecting:
After upgrading to
^v5.0.0
some of our GraphQL queries have broken. This is the result of this commit where acontext
was added aftergetOptions
.What happened instead:
We're unable to populate custom context on a GraphQL query.
Steps to reproduce:
query
option.ApolloLink.split(...)
.Related code:
Here is the commit where this change was introduced where a
context
was added aftergetOptions
:The reason for this is that we've passed a custom
query
option to thebuildGraphQLProvider
function. Thisquery
function populates some custom context like so:We then use this context in
ApolloLink.split()
to determine what endpoint to route a given request to.Other information:
I realize that this might be a niche use-case. However, I think the problem would be easily avoidable via one of the following:
context
was generated from thequery
function and, if so merging it with the newfetchOptions
context....getOptions(otherOptions.query, raFetchMethod, resource),
call and leave it to the end user to deal with (e.g. force them to pass that option in their context.I'll also add that I'm happy to submit a PR if the maintainers approve.
Environment
5.0.3
4.16.19
.^18.3.0
The text was updated successfully, but these errors were encountered: