Skip to content
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

[PM-16133] - [Vault] Implement persistence on filters in Vault view #13303

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

jaasen-livefront
Copy link
Collaborator

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-16133

📔 Objective

This PR introduces persistence of the vault filters and search function. It leverages the PopupViewCacheService as the caching mechanism.

📸 Screenshots

Screen.Recording.2025-02-06.at.4.44.28.PM.mov

⏰ Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Protected functional changes with optionality (feature flags)
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team

🦮 Reviewer guidelines

  • 👍 (:+1:) or similar for great changes
  • 📝 (:memo:) or ℹ️ (:information_source:) for notes or general info
  • ❓ (:question:) for questions
  • 🤔 (:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion
  • 🎨 (:art:) for suggestions / improvements
  • ❌ (:x:) or ⚠️ (:warning:) for more significant problems or concerns needing attention
  • 🌱 (:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt
  • ⛏ (:pick:) for minor or nitpick changes

Copy link

codecov bot commented Feb 7, 2025

Codecov Report

Attention: Patch coverage is 81.63265% with 9 lines in your changes missing coverage. Please review.

Project coverage is 35.13%. Comparing base (101cd94) to head (397ae37).
Report is 54 commits behind head on main.

Files with missing lines Patch % Lines
...popup/services/vault-popup-list-filters.service.ts 80.48% 2 Missing and 6 partials ⚠️
...vault-v2/vault-search/vault-v2-search.component.ts 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13303      +/-   ##
==========================================
- Coverage   35.50%   35.13%   -0.37%     
==========================================
  Files        3010     3031      +21     
  Lines       90934    92549    +1615     
  Branches    16915    16853      -62     
==========================================
+ Hits        32282    32518     +236     
- Misses      56149    57571    +1422     
+ Partials     2503     2460      -43     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

github-actions bot commented Feb 7, 2025

Logo
Checkmarx One – Scan Summary & Details4a43a4b0-193c-4619-a670-9313aa1d7c86

New Issues (2)

Checkmarx found the following issues in this Pull Request

Severity Issue Source File / Package Checkmarx Insight
MEDIUM CVE-2024-55565 Npm-nanoid-3.3.7 Vulnerable Package
MEDIUM Client_Privacy_Violation /apps/desktop/src/app/tools/password-generator-history.component.html: 15
detailsMethod password_generator_history_component at line 15 of /apps/desktop/src/app/tools/password-generator-history.component.html sends user informat...
Attack Vector

@@ -1,5 +1,3 @@
// FIXME: Update this file to be type safe and remove this and next line
// @ts-strict-ignore
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏 Thanks for fixing this as you passed by!

@@ -282,8 +286,8 @@ export class VaultPopupItemsService {
private accountService: AccountService,
) {}

applyFilter(newSearchText: string) {
this._searchText$.next(newSearchText);
applyFilter(newSearchText: string | null) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 applyFilter is a little ambiguous in the context of the chip filters. Maybe another name for the method would make it more intuitive? applySearchFilter, updateSearchText?

No change needed if you don't agree

Comment on lines +199 to +201
toObservable(cachedFilters)
.pipe(filter((state) => Object.keys(state).length > 0))
.subscribe((state) => this.deserializeFilters(state));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ Does this need to be an observable if it is only supposed to load the initial filters?

this.deserializeFilters(cachedFilters());

const FILTER_VISIBILITY_KEY = new KeyDefinition<boolean>(VAULT_SETTINGS_DISK, "filterVisibility", {
deserializer: (obj) => obj,
});

export interface CachedFilterState {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⛏️ Could you add a comment about why the CachedFilterState differs from the internal state?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants