-
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
fetchMore with variables doesn't update field policy read args #7496
Comments
@jmmendivil The |
This is really surprising behavior. Why wouldn't you want the updated query variables in your read function? |
Given above, you don't really need |
It doesn't sound like there is an outstanding issue here, so closing. Thanks! |
How should I go about implementing a cursor based pagination where I can also preserve the index of the items like in this example (https://www.apollographql.com/docs/react/pagination/cursor-based/#using-list-element-ids-as-cursors) if the |
Ah... I've been using apollo for months and can't believe I've only just discovered this. In fact two recent discoveries which struck me as odd together now make sense. The first discovery was the following query will execute again when the variables passed to the hook change. Hitherto I'd always assumed that fetchMore was the only way of getting further data for the original query set up in the hook. In fact I questioned whether this was intended behaviour here because I couldn't understand why this would be - #8847
Today I stumbled upon this issue because I too noticed that args passed to read did not reflect variables passed to fetchMore. So my first discovery is the solution for ensuring the correct args are passed to read. Together I now have something like this -
I'm sure last time I read the docs for the Query section where fetchMore is first introduced this is not discussed. I'd strongly recommend changing the docs so that users new to apollo understand from the beginning that fetchMore really means fetchMore of the original query. I'm sure many like me just assumed it was the ONLY WAY of getting anything more from the original query. |
Hi guys.
I'm trying to get used to using
typePolicies
, it's awesome to have the logic in a single point instead of everyupdateQuery
, but when I do afetchMore()
it seems like the args from theread()
aren't updated like themerge()
and I need them to do a Paginated view as in Paginated read functions.Intended outcome:
Get the same args in
read()
as inmerge()
on every update withfetchMore()
.Actual outcome:
args in
read()
doesn't update withfetchMore()
.How to reproduce the issue:
TypePolicy:
Query:
useQuery hook:
fetchMore
Versions
The text was updated successfully, but these errors were encountered: