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
Describe the bug
I've encountered unexpected behavior when using ref.exists() in a provider with dependencies, specifically when combined with the keepAlive property in Riverpod. The issue arises when checking the existence of a keepAlive provider within another provider that has dependencies. The expected behavior is for ref.exists() to return true consistently for a keepAlive: true provider, but this doesn't seem to be the case when overridden dependencies with ProviderScope are involved.
Expected behavior
The ref.exists(fetchCounterProvider(id)) should consistently return true for a provider that is marked as keepAlive: true, independent of the dependencies in the consuming provider.
Actual Behavior
When detailScreenCounterProvider does not have dependencies, or when dependencies are empty (dependencies: []), ref.exists(fetchCounterProvider(id)) returns true as expected for a keepAlive: true provider.
However, when detailScreenCounterProvider has a specific dependency (e.g., [counter]), and this dependency is overridden with ProviderScope as shown below, ref.exists(fetchCounterProvider(id)) returns `false:
Describe the bug
I've encountered unexpected behavior when using
ref.exists()
in a provider with dependencies, specifically when combined with thekeepAlive
property in Riverpod. The issue arises when checking the existence of akeepAlive
provider within another provider that has dependencies. The expected behavior is forref.exists()
to return true consistently for akeepAlive: true
provider, but this doesn't seem to be the case when overridden dependencies withProviderScope
are involved.To Reproduce
Code sample
Expected behavior
The ref.exists(fetchCounterProvider(id)) should consistently return true for a provider that is marked as keepAlive: true, independent of the dependencies in the consuming provider.
Actual Behavior
When detailScreenCounterProvider does not have dependencies, or when dependencies are empty (
dependencies: []
),ref.exists(fetchCounterProvider(id))
returnstrue
as expected for akeepAlive: true
provider.However, when
detailScreenCounterProvider
has a specific dependency (e.g.,[counter]
), and this dependency is overridden withProviderScope
as shown below,ref.exists(fetchCounterProvider(id))
returns `false:This unexpected behavior occurs despite
fetchCounterProvider
being marked askeepAlive: true
.The text was updated successfully, but these errors were encountered: