From f24388c1b5f81cb85193aec1450934028a6d7203 Mon Sep 17 00:00:00 2001 From: mp-bw <59324545+mp-bw@users.noreply.github.com> Date: Wed, 15 Jun 2022 15:18:30 -0400 Subject: [PATCH] separate init and showVaultFilter property set (#1954) --- src/App/Pages/Vault/CiphersPageViewModel.cs | 2 +- .../Pages/Vault/GroupingsPage/GroupingsPageViewModel.cs | 2 +- src/App/Pages/VaultFilterViewModel.cs | 9 ++++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/App/Pages/Vault/CiphersPageViewModel.cs b/src/App/Pages/Vault/CiphersPageViewModel.cs index 1a4be4164..c1c8fcd03 100644 --- a/src/App/Pages/Vault/CiphersPageViewModel.cs +++ b/src/App/Pages/Vault/CiphersPageViewModel.cs @@ -87,7 +87,7 @@ namespace Bit.App.Pages public async Task InitAsync() { - await InitVaultFilterAsync(); + await InitVaultFilterAsync(true); WebsiteIconsEnabled = !(await _stateService.GetDisableFaviconAsync()).GetValueOrDefault(); PerformSearchIfPopulated(); } diff --git a/src/App/Pages/Vault/GroupingsPage/GroupingsPageViewModel.cs b/src/App/Pages/Vault/GroupingsPage/GroupingsPageViewModel.cs index 9cc52dc8a..9b2855853 100644 --- a/src/App/Pages/Vault/GroupingsPage/GroupingsPageViewModel.cs +++ b/src/App/Pages/Vault/GroupingsPage/GroupingsPageViewModel.cs @@ -181,9 +181,9 @@ namespace Bit.App.Pages return; } + await InitVaultFilterAsync(MainPage); if (MainPage) { - await InitVaultFilterAsync(); PageTitle = ShowVaultFilter ? AppResources.Vaults : AppResources.MyVault; } diff --git a/src/App/Pages/VaultFilterViewModel.cs b/src/App/Pages/VaultFilterViewModel.cs index 24ea7f042..4435be072 100644 --- a/src/App/Pages/VaultFilterViewModel.cs +++ b/src/App/Pages/VaultFilterViewModel.cs @@ -61,7 +61,7 @@ namespace Bit.App.Pages protected bool IsVaultFilterOrgVault => _vaultFilterSelection != AppResources.AllVaults && _vaultFilterSelection != AppResources.MyVault; - protected async Task InitVaultFilterAsync() + protected async Task InitVaultFilterAsync(bool shouldUpdateShowVaultFilter) { _organizations = await organizationService.GetAllAsync(); if (_organizations?.Any() ?? false) @@ -77,8 +77,11 @@ namespace Bit.App.Pages VaultFilterDescription = AppResources.AllVaults; } } - await Task.Delay(100); - ShowVaultFilter = await policyService.ShouldShowVaultFilterAsync(); + if (shouldUpdateShowVaultFilter) + { + await Task.Delay(100); + ShowVaultFilter = await policyService.ShouldShowVaultFilterAsync(); + } } protected async Task> GetAllCiphersAsync()