-
Notifications
You must be signed in to change notification settings - Fork 55
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
Remove Refreshing From AsyncState #356
Comments
Well I think there are 2 reasons we could keep it:
For 2 this is common in an infinite list where the initial load you show the indicator but not when new data comes in (firestore or sqlite stream) or when appending to the end of the list. I think we can simplify this more in a future release (v7?) but v6 can be about ease of migration, documentation, examples and cleaning up as much as possible. |
For 2, the Having both, with no functional difference, may be confusing. In some places users might call switch(state) {
AsyncDataReloading(:final data) || AsyncDataRefreshing(:final data) => ...,
AsyncData(:final data) => ...,
AsyncError() => ...,
AsyncLoading() => ...,
} Rather than just switch(state) {
AsyncDataReloading(:final data) => ...,
AsyncData(:final data) => ...,
AsyncError() => ...,
AsyncLoading() => ...,
} Definitely going to require a v7, as you mentioned, as this is a breaking change. But the sooner the better in my opinion. It might be worth while if this is the accepted, to deprecate |
Yes I am totally in favor of deprecating to prepare! |
This came as a result of looking into #351 . The idea of having a "refreshing" state and a "reloading" state does not make a lot of sense for signals. The reasoning in the article I previously referenced states that - one is for when the original condition that led to the data/error is the same and the other is for when the condition changes.
Diving into riverpod's source code. I found this reasoning to be more specific to the riverpod implementation - "refreshing" signifies that the refresh was a manual action caused by
ref.refresh()
/ref.invalidate()
(thus original condition not changed). While "reloading" is from a dependency change resulting in the provider being recomputed. In fact, in riverpod there is noref.reload()
, this is only handled by the framework. As a previous user of riverpod I have yet to ever care aboutthis distinction between the two states.
In signals, we expose
.refresh()
and.reload()
to the end user. Thus, what is the proper distinction between the two for this library? Since we expose.reload()
it would seem the reasoning behind the "reloading" state existing in riverpod,does not exist here. We could probably just remove
.refresh()
and..Refreshing
state. And have..Reloading
refer do both an internal refresh (dependencies change) and a manual call to.reload()
. I'd argue, this is what users care about anyways. This would streamline the API.The text was updated successfully, but these errors were encountered: