-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Feature/infinite queries #5004
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
Feature/infinite queries #5004
Conversation
we should always return a boolean here, and according to the docs and the implementation in infiniteQueryBehaviour, we will only stop fetching if we return `undefined` from `getNextPageParam` or `getPreviousPageParam`. The checks for `false` or `null` on this boolean were likely wrong
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 3bb0c34:
|
Codecov ReportBase: 90.50% // Head: 90.41% // Decreases project coverage by
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more Additional details and impacted files@@ Coverage Diff @@
## alpha #5004 +/- ##
==========================================
- Coverage 90.50% 90.41% -0.09%
==========================================
Files 104 104
Lines 3811 3788 -23
Branches 961 948 -13
==========================================
- Hits 3449 3425 -24
- Misses 329 330 +1
Partials 33 33
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
* feat: add PageParam typing * feat(infinite-query): more typing * feat(infinite-query): make pageParam never by defaukt * feat(infinite-query): PageParam type unknown for infinite queries * fix(infinite-query): fix tests * feat(infinite-query): add previous end next return TPageParam type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm, do we still need pageParams
in return of useInfiniteQuery
? 🤔
For what it can be usefull?
because it might be mistaken for a full set of options, which it is not
I outlined the problems in the initial RFC. We still need the
this will start out with:
now let's fetch some more in the forward direction:
so far, so good. If a refetch happens now, it always starts at the beginning and then refetches all pages in order. so we:
Now it seems, we could just re-use the
we now have to start the fetch chain with
now, we would have to start with Grabbing this info from the
Alternatively, we would have to store the information "what's the pageParam of the current first page" somewhere on the |
@TkDodo But it seems that it's now more like an implementation detail, rather than something users could use. If it's not usefull for users it would be good to hide this somewhere. And what we really need is something like But question is, how would we store this firstPageParam with persisters? Or do we even need to do that? |
yes, I agree.
cache manipulation, yes. select, kinda. It should be possible to transform to anything via select. it works at runtime, but not on type level. I've added some failing type level tests. I think we should fix them first before changing the structure.
yes, we would need to store it. it could be part of the query/packages/query-core/src/query.ts Lines 37 to 50 in 765f619
I will need to look into it. We don't have an |
hmm, it's mostly an implementation detail, but when working directly with the cache, you'd still need to set it. As an example, assume you have 3 pages:
if we take away |
…eature/infinite-queries
* feat(select): defer TData inference * test(select): restore test * fix(select): change InfiniteQuery Observer definition * fix(infinite-queries): fix solid type inference select * fix(infinite-queries): fix solid type inference select * chore(infinite-queries): fix prettier * fix(infinite-queries): fix vue and svelte types * fix(infinite-queries): fix react type inference select * chore(infinite-queries): fix imports * style: fix prettier warnings
@ardeora I'll merge this PR into alpha because it contains some good improvements on the API. If we find a way to get rid of the |
No description provided.