From c0caaf9ce9385996b4ad549b0cdf157de4bbba84 Mon Sep 17 00:00:00 2001 From: David Perez Date: Fri, 5 Jun 2026 13:06:20 -0500 Subject: [PATCH] PM-38513: Bug: Do not emit policies before we have recieved them (#7023) --- .../data/platform/manager/PolicyManagerImpl.kt | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/app/src/main/kotlin/com/x8bit/bitwarden/data/platform/manager/PolicyManagerImpl.kt b/app/src/main/kotlin/com/x8bit/bitwarden/data/platform/manager/PolicyManagerImpl.kt index 51febc4595..cd4a955552 100644 --- a/app/src/main/kotlin/com/x8bit/bitwarden/data/platform/manager/PolicyManagerImpl.kt +++ b/app/src/main/kotlin/com/x8bit/bitwarden/data/platform/manager/PolicyManagerImpl.kt @@ -16,6 +16,7 @@ import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.emptyFlow +import kotlinx.coroutines.flow.filterNotNull import kotlinx.coroutines.flow.flatMapLatest import kotlinx.coroutines.flow.map @@ -95,15 +96,15 @@ class PolicyManagerImpl( }, featureFlagManager.getFeatureFlagFlow(key = FlagKey.PoliciesInAcceptedState), ) { policies, organizations, isEnabled -> - this - .filterPolicies( - type = type, - policies = policies, - organizations = organizations, - isPoliciesInAcceptedStateEnabled = isEnabled, - ) - .orEmpty() + filterPolicies( + type = type, + policies = policies, + organizations = organizations, + isPoliciesInAcceptedStateEnabled = isEnabled, + ) } + // We do not have any policies yet if it is null, so do not emit at all. + .filterNotNull() private fun filterPolicies( type: PolicyType,