Skip to content
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

Concat data on refetch (e.g: For infinite scroll) #280

Closed
pradel opened this issue Jun 14, 2016 · 5 comments
Closed

Concat data on refetch (e.g: For infinite scroll) #280

pradel opened this issue Jun 14, 2016 · 5 comments

Comments

@pradel
Copy link

pradel commented Jun 14, 2016

Hi,

I am trying to make an infinite scroll, the problem is actually when you refetch a query old data are erased. Maybe It can be good to pass some options on refetch ?
Something like that ? data.refetch({ newArgs }, { concat: true });

@stubailo
Copy link
Contributor

I asked pradel to open this issue so that we can discuss a minimal viable design for infinite scroll pagination, let's see if we can come up with something simple!

@jbaxleyiii
Copy link
Contributor

@pradel @stubailo I like the simplicity of data.refetch(<variables>, <settings>). The second argument can be expanded to control other aspects of refetching we may want to add in. To take it a step further, should we add concat on the WatchQueryOptions and the second arg of refetch allows overwriting of existing query options? This would allow polling changes as well as other additions to WatchQueryOptions

@stubailo
Copy link
Contributor

I am not sure that this belongs on refetch, personally - I'd be in favor of similar but alternative approaches, for example:

  1. A fetchMore method in addition to refetch
  2. A way to assemble an array of queries with different variables programmatically

I don't think refetch should be overloaded to do more than simply rerun a single query maybe with different variables.

@rricard
Copy link
Contributor

rricard commented Jun 28, 2016

Ok, I have the same needs and I would be interested to take on that issue and implement a fetchMore(variables) method. If you are open to that, I could start working on a PR.

@Poincare
Copy link
Contributor

Poincare commented Aug 2, 2016

Done thanks to @Slava and @rricard

@Poincare Poincare closed this as completed Aug 2, 2016
jbaxleyiii pushed a commit that referenced this issue Oct 18, 2017
Updated simple-example.md
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants