Incremental loading for infinite scrolling
See original GitHub issueI am implementing infinite scrolling for a list of tickets. Currently, recoil doesnt seem to offer a way to get all data that a selector has fetched.
Example:
export const issues = selector({
key: 'issueList',
get: async ({ get }) => {
const cursor = get(issuesCursor);
const client = getApolloClient();
const issues = await client.query<IssuesQuery, IssuesQueryVariables>({
query: IssuesDocument,
variables: {
cursor,
},
});
return { nextCursor: issues.data.issuesCursor.cursor, items: issues.data.issuesCursor.items };
},
});
export const issueList = selector({
key: 'nextIssuesCursor',
get: ({ get }) => get(issues).items,
});
I would like to receive all issues from the issueList selector.
I can solve this issue with a hook, yet i would strongly prefer keeping all the data fetching in recoiljs.
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Infinite Scrolling with Incremental Data Loading in Xamarin ...
CollectionView has built-in ability to fetch additional data when the user scrolls through the content already loaded. As the data threshold ...
Read more >Implementing Infinite Scroll And Image Lazy Loading In React
The effect is to increment the value of pager.page by 1. Once this happens, the useEffect hook that has it as a dependency...
Read more >Infinite Scrolling with Incremental Loading in Windows Phone 8
In mobile applications there's often a need for scrolling lists with large or even (for all practical purposes) infinite amounts of data ...
Read more >c# - How to scrolling up and down using Incremental Loading ...
But I need the view to starts showing from middle of the list, and if scrolling up and down, the items should be...
Read more >Options - Infinite Scroll
Loading. path. Determines the URL for the next page. Required. Set to a selector string of a link to the next page to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I finished implementing the way @drarmstr recommended and it worked like a charm. Thanks a lot.
@mastorm / @BenjaBobs Would a solution using
useRecoilCallback()
like the following work?But, the most versatile or appropriate for this situation might be using the
waitForNone()
helper to handle the incremental loading pattern: