You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This works great as long as the itemId does not change. When I navigate to a page the first time, it pulls in the expected lastest items (descending order by publishedAt). And then after that, on scrolling it loads the older items, again as expected.
However, when I navigate to a different item page (i.e. itemId is different), it adds the records for this new item to the existing state of records.
I would like to clear the state when the itemId changes. How can I achieve this (or am I not fundamentally using it in a different way)?
The text was updated successfully, but these errors were encountered:
For now, I am detecting in GoRouter's redirect hook if the app is redirecting to the screen in question, and clearing the state of paginated items, if so.
But it does sound like a hack. Please let me know if there is a better way.
Hi @arnab sorry I've not been using flutter for a long time, are you still interested in a help here?
From what I see maybe a family provider is needed in your case where the family is the itemId
Context
I have the following
RiverPagedBuilder
:And here is the
paginatedControllerProvider
:Problem
This works great as long as the
itemId
does not change. When I navigate to a page the first time, it pulls in the expected lastest items (descending order by publishedAt). And then after that, on scrolling it loads the older items, again as expected.However, when I navigate to a different item page (i.e.
itemId
is different), it adds the records for this new item to the existing state of records.I would like to clear the state when the
itemId
changes. How can I achieve this (or am I not fundamentally using it in a different way)?The text was updated successfully, but these errors were encountered: