-
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
Cache FieldPolicy.merge receives stale args when using fetchMore #5951
Comments
I think you should be using |
@benjamn you are right, i should have used |
hi @benjamn thanks for all your hard work on these updates. I was following this thread as I'm about to attempt to implement fetchMore using the new merge function on the typePolicy API but I noticed you added this issue to the Release 3.0 milestone, should I hold off until it's ready or should the args be coming in updated now? thanks again, great work! Double checked and I get the old args from before fetchMore. |
I can confirm this as well. The args passed to merge after a call to |
Chiming in here, Looks like the issue is that @benjamn What do you think is the best option to solve this? |
Thanks @chrisgco! Your diagnosis is absolutely correct, and you made my job a lot easier by sharing your findings. I want to apologize to everyone here for the sorry shape of We should have this fixed (and more thoroughly tested) very soon. |
@benjamn I wonder if this also applies to refetch? We have been having a lot of problems with refetch and refetchQueries for a while now on 3.0.0. It's kind of hard to pin down since it doesn't seem to occur always. Is there anything to be aware of? I want to spend some time on trying to create a reproduction. But the jist of it is that when it happens,
|
This commit also deprecates the updateQuery function, while preserving its existing behavior for backwards compatibility. If you're using a field policy, you shouldn't need an updateQuery function. Fixes #5951.
This commit also deprecates the updateQuery function, while preserving its existing behavior for backwards compatibility. If you're using a field policy, you shouldn't need an updateQuery function. Fixes #5951.
Great 🚀 |
sweet! |
This is still an issue for me. I'm using version - 3.7.0-beta.5. Does anybody else have the problem? I also had the problem with version 3.6. |
This is happening to me with the read function on v3.6.9. |
I am not shure if this is a bug or if i am using
fetchMore
in the wrong way. Help would be greatly appreciated.Intended outcome:
When using
fetchMore
for a pagination queryFieldPolicy.merge
should be called withFieldFunctionOptions.args
that correspond to the variables given tofetchMore
.Actual outcome:
FieldFunctionOptions.args
always contains the field variables of the initial query (e.g.limit: 30, offset: 0
). Even iffetchMore
was called with e.g.offset: 10
.Code
Client configuration
Query
Custom Query hook
Use of query hook in component
Versions
The text was updated successfully, but these errors were encountered: