-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
updateQuery merging different data when changing query while fetchMore is not yet finished #2813
Comments
I'm experiencing the same behaviour. When the variables for the query are changed while fetchMore is in flight, the results of "fetchMore" (for the old variables) will be merged with the results of the query with current variables. Example: You have a list with 2 tabs (changing tabs will change the "category"-variable for the query). So fetchMore is in progess while having tab 1 selected (category 1). Now the users switches to tab 2 and later the fetchMore results for tab 1 will be appended to tab 2. The updateQuery-Function should provide the "previosResults" for the initial variables so we can merge accordingly. |
Is there any update regarding this issue? |
Any chances to fix that 5-months old issue? It seems to be quite significant disfunction. (a bit funny situation, considering an activity of Apollo team on various React confs and theirs efforts to promote Apollo integrations...) |
Should be fixed by #4640 |
@jakwuh Thank you. Hopefully that gets reviewed soon. Do you know of any workarounds I could use in the meantime? |
@dylanwulf yes, you can implement your own |
@jakwuh I am not quite sure I follow how to implement a custom graphql enhancer to solve this problem. Maybe I am too deep into trying different implementations to see clearly but could you give a little insight on how this could be accomplished? |
Any update on the status of this issue? |
I'm also very interested in the progress of this. My company has been struggling with bugs for some time now caused by this issue, and we've been unsuccessful in multiple attempts to work around it. Any update on if/when #4640 might be merged? |
A lot of the Apollo Client internals have changed since v3 was launched. We recommend trying a more modern version of |
I do still experience this issue in v3, I am going to try to create a reproducible example. |
Hi, I've read #2499 and I don't know if it this issue I'm having is related or not.
I am having this issue where
prev
andresult
onupdateQuery(prev, result)
having different context on the data to merge. It happens when I changed query (changing search term) while fetchMore is not yet finished, resulting in items with different query being merged.How to reproduce the issue:
Case:
pillow
already have some data, and calling fetchMore.iphone
.iphone
search query data are merged inupdateQuery
withpillow
fetchMore result.Sorry, I am currently unable to provide the repository to reproduce this. I will provide it later if it's necessary.
Intended outcome:
I think the intended outcome is obvious, the
pillow
fetchMore result should be merged according to its search term (fetched earlier in step 1).This is the code I've been using:
Actual outcome:
The data from
pillow
fetchMore are merged in updateQuery withiphone
, resulting in wrong search result displayed.Weirdly, the
res.variables
inupdateQuery(prev, res)
showing that the query is foriphone
instead of the actual query for fetchMore, which ispillow
.Version
The text was updated successfully, but these errors were encountered: