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
My setup includes a TextField for a search query and a list of items to filter based on the query.
The list of items is stored in NewsStore.
The search query is stored in SearchQueryController.
The filtering occurs in newsPresenter. To illustrate the difference in behavior, I've created a second version, newsPresenterSync.
There are NewsListPage and NewsListSyncPage, which use newsPresenter and newsPresenterSync, respectively, to display the filtered list of items.
In the case of newsPresenter, the searchQueryControllerProvider is disposed right after the value change, resulting in NewsListPage displaying the original list of items.
Conversely, in the newsPresenterSync scenario, the searchQueryControllerProvider remains active with the new value, so NewsListSyncPage shows a filtered list of items.
Is this an expected behavior, or am I missing something?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I anticipated encountering this issue: the AsyncNotifierProvider gets disposed when one of its dependencies changes value.
I have prepared a Minimal Reproducible Example (MRE) available here: https://github.com/ynlvko/riverpod_mre
My setup includes a TextField for a search query and a list of items to filter based on the query.
NewsStore
.SearchQueryController
.newsPresenter
. To illustrate the difference in behavior, I've created a second version,newsPresenterSync
.NewsListPage
andNewsListSyncPage
, which usenewsPresenter
andnewsPresenterSync
, respectively, to display the filtered list of items.In the case of
newsPresenter
, thesearchQueryControllerProvider
is disposed right after the value change, resulting inNewsListPage
displaying the original list of items.Conversely, in the
newsPresenterSync
scenario, thesearchQueryControllerProvider
remains active with the new value, soNewsListSyncPage
shows a filtered list of items.Is this an expected behavior, or am I missing something?
Beta Was this translation helpful? Give feedback.
All reactions