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-12759] - Admin Console - Link to vault cipher is not opening cipher modal #12738

Merged
merged 5 commits into from
Jan 10, 2025

Conversation

jaasen-livefront
Copy link
Collaborator

@jaasen-livefront jaasen-livefront commented Jan 8, 2025

🎟️ Tracking

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

📔 Objective

This PR fixes an issue where on initial load the org vault cipher dialog was not opening even when itemId and action=view params were present. This was due to the use of withLatestFrom which was firing on first emission of the query param observable but the array of observables passed in (allCipherMap$, allCollections$, organization$) had not yet emitted and thus the stream was halted. Using switchMap ensures all observables have emitted before running.

Steps to test for success:

  • navigate to an org and click on a vault item
  • reload page
  • item modal should appear

📸 Screenshots

⏰ 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

@jaasen-livefront jaasen-livefront requested a review from a team as a code owner January 8, 2025 00:37
@shane-melton shane-melton self-requested a review January 8, 2025 00:38
@jaasen-livefront jaasen-livefront changed the title [PM-12759] - fix initial load emission race [PM-12759] - Admin Console - Link to vault cipher is not opening cipher modal Jan 8, 2025

This comment was marked as off-topic.

Copy link

codecov bot commented Jan 8, 2025

Codecov Report

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

Project coverage is 34.15%. Comparing base (bb61b3d) to head (13d7b73).

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...pps/web/src/app/vault/org-vault/vault.component.ts 0.00% 9 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #12738   +/-   ##
=======================================
  Coverage   34.14%   34.15%           
=======================================
  Files        2937     2937           
  Lines       90340    90345    +5     
  Branches    16963    16964    +1     
=======================================
+ Hits        30846    30853    +7     
+ Misses      57039    57037    -2     
  Partials     2455     2455           

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

// Only process the queryParams if the dialog is not open (only when extension refresh is enabled)
filter(() => this.vaultItemDialogRef == undefined || !this.extensionRefreshEnabled),
withLatestFrom(allCipherMap$, allCollections$, organization$),
switchMap(() => combineLatest([this.route.queryParams, allCipherMap$])),
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe switching this to combineLatest is going to have multiple emissions from the observable. The withLatestFrom was to address this bug previously PM-12678

this change also seems to result in the edit modal being called multiple times. Screen recording below:

PM-12759.mov

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@Jingo88 Ok I've added some logic to prevent double rendering. Let me know what you think!

@jaasen-livefront jaasen-livefront merged commit b8f57f3 into main Jan 10, 2025
37 checks passed
@jaasen-livefront jaasen-livefront deleted the PM-12759 branch January 10, 2025 18:01
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