cached_query icon indicating copy to clipboard operation
cached_query copied to clipboard

Docs clarification & missing infinite query fetch option case

Open iOSonntag opened this issue 5 months ago • 4 comments

Hi There hope your doing well, I have a tiny misleading docs fix to offer:

In the infinite query you have this part:

/// If the fist page has changed then revalidate all pages. Defaults to false.
final bool revalidateAll;

I thought it means when set to false, the query will still keep the old data in the following pages and just wont refetch them. So i set it to true everywhere because I needed to update all old pages (or even better discard them). Later on I realized that setting this to false is actually what I want, that is fetch first page and discard all other pages.

Also note that you abbandonded the logic for check for first page equality and have the following comment in code:

// Note: Removed re-fetching all pages if the first page has changed unless force revalidate is on.
// this was taking too long and didn't seam worth it.

Maybe some renaming would be great here.

The second thing I noticed is that there is a special case that you might want to cover:

Imagine you store your infinite queries on disk, and imagine you have a highscore list with 10.000 users, and imagine that the first 10 players no longer play this game (first page). Now if you refetch the query with forceRevalidateAll = false then the highscore list will never ever be updated because the first page doesnt change so the old data is just returned. The only way to neglect that behaviour is by setting forceRevalidateAll to true. That has the unintended consiquence, that all pages are beeing refetched all the time and every refetch. If the data is stored on disk that means that a single user might. triger 100 requests every time he wants to refetch the highscore list.

There should be an option that clears the infinite query data EVEN if the first page is equal

iOSonntag avatar Sep 24 '24 08:09 iOSonntag