Skip to content

[PM-43011] feat: Land on newly created vault item after save - #7417

Merged
aj-rosado merged 4 commits into
mainfrom
PM-43011/land-on-newly-created-item
Sep 23, 2026
Merged

aj-rosado merged 4 commits into
mainfrom
PM-43011/land-on-newly-created-item

Conversation

@aj-rosado

Copy link
Copy Markdown
Contributor

🎟️ Tracking

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

📔 Objective

When a user creates a new vault item, navigate directly to the newly created item's view screen and show a "saved" snackbar there, instead of navigating back to the previous screen. The autofill-selection save flow is unchanged.

📸 Screenshots

N/A — navigation/snackbar timing change only, no new UI.

@aj-rosado aj-rosado added the ai-review Request a Claude code review label Sep 22, 2026
@github-actions github-actions Bot added app:password-manager Bitwarden Password Manager app context t:feature Change Type - Feature Development labels Sep 22, 2026
@github-actions

github-actions Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

🤖 Bitwarden Claude Code Review

Overall Assessment: APPROVE

Reviewed the save-flow change that lands the user on a newly created vault item: CreateCipherResult.Success now carries cipherId, VaultAddEditViewModel emits CloseAndNavigateToVaultItem for the normal create path, and VaultItemViewModel shows the "saved" snackbar from a new showCreatedSnackbar route argument. I traced all four outcomes in handleCreateCipherResultReceive and confirmed only the normal create path changes — VaultUnlockedForAutofillSave and VaultUnlockedForCreatePasswordRequest still resolve through ExitApp / CompleteCredentialRegistration, and the autofill-selection branch (!shouldClearSpecialCircumstance) still relays CIPHER_CREATED with NavigateBack to VaultItemListingViewModel, which remains a subscriber after the relay was dropped from VaultViewModel. I verified SyncResponseJson.Cipher.id is non-nullable, that state.cipherType is assigned once from the nav args with no in-screen type switcher so the type handed to the item screen always matches (including the clone path, which forwards event.type), and that getVaultItemStateFlow resolves through CipherManagerImpl.getCipher, which reads the cipher straight from vaultDiskSource — written and awaited before Success is returned — so the item screen cannot transiently render a not-found state. The remaining 9 VaultItemArgs call sites all rely on the showCreatedSnackbar = false default, so no other entry point into the item screen is affected.

Code Review Details

No findings met the confidence threshold for posting.

Candidates considered and dismissed during validation:

  • else if (!state.shouldClearSpecialCircumstance) reusing a field named for a different concern as the "autofill selection in progress" signal — a readability/coupling concern, but it was raised in review, the author added an explanatory comment, and there is no measurable complexity reduction on offer.
  • Event lost when sendEvent fires from VaultItemViewModel.init before the screen collects — BaseViewModel backs eventFlow with an UNLIMITED Channel, ShowSnackbar implements BackgroundEvent so EventsEffect does not gate it on RESUMED, and BitwardenSnackbarHostState.showSnackbar writes to Compose state rather than requiring a live host.
  • Repeat snackbar after process death or re-entry — hasShownCreatedSnackbar is persisted in the nav entry's SavedStateHandle (KEY_STATE is read-only in production, so state is rebuilt from args while the flag survives), and a regression test covers recreation against the same handle.
  • popUpTo<VaultAddEditRoute> { inclusive = true } emptying the back stack — vaultUnlockedGraph's start destination is VaultUnlockedNavbarRoute, and the only paths that launch add/edit as a root resolve through ExitApp or CompleteCredentialRegistration before reaching the new branch.
  • Extra CipherClientViewed organization event now logged on create — a genuine consequence of the user actually landing on the item view, not a defect.
  • Coverage drop flagged by Codecov (VaultItemNavigation.kt, VaultAddEditNavigation.kt) — navigation wiring consistent with how these files are already treated in this codebase.

@codecov

codecov Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.00000% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.39%. Comparing base (a258622) to head (2e1aea4).
⚠️ Report is 13 commits behind head on main.

Files with missing lines Patch % Lines
...arden/ui/vault/feature/item/VaultItemNavigation.kt 14.28% 6 Missing ⚠️
...ui/vault/feature/addedit/VaultAddEditNavigation.kt 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7417      +/-   ##
==========================================
- Coverage   86.10%   84.39%   -1.72%     
==========================================
  Files         947      949       +2     
  Lines       67238    67370     +132     
  Branches     9335     9346      +11     
==========================================
- Hits        57894    56854    -1040     
- Misses       5857     7054    +1197     
+ Partials     3487     3462      -25     
Flag Coverage Δ
app-data 18.02% <5.71%> (-0.19%) ⬇️
app-ui-auth-tools 18.68% <0.00%> (-0.15%) ⬇️
app-ui-platform 16.30% <2.85%> (-0.29%) ⬇️
app-ui-vault 27.00% <74.28%> (-0.62%) ⬇️
authenticator 5.98% <0.00%> (-0.04%) ⬇️
lib-core-network-bridge 4.07% <0.00%> (-0.01%) ⬇️
lib-data-ui 1.19% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@aj-rosado
aj-rosado marked this pull request as ready for review September 22, 2026 16:37
@aj-rosado
aj-rosado requested review from a team and david-livefront as code owners September 22, 2026 16:37
@aj-rosado aj-rosado added t:feature Change Type - Feature Development and removed t:feature Change Type - Feature Development labels Sep 22, 2026
*/
data object Success : CreateCipherResult()
data class Success(
val cipherId: String,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

👍

)
sendEvent(event = VaultAddEditEvent.NavigateBack)
} else {
sendEvent(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should we still show the sanckbar?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I saw that we show the snackbar based on a nav-arg. I assume that is because the screen does not yet exist and the sanckbar will be consumed elsewhere?

I think that all seems fine but can we drop a comment here indicating that the sanckbar is handled elsewhere.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Exactly, we do not have the screen yet so I am passing an argument to the screen to display the snackbar.
Will add a comment stating it.

)
if (savedStateHandle.toVaultItemArgs().showCreatedSnackbar && !hasShownCreatedSnackbar) {
hasShownCreatedSnackbar = true
sendEvent(VaultItemEvent.ShowSnackbar(message = state.cipherType.savedSnackbarMessage))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Ahhh, so this is how you are displaying the snackbar

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Will definitely add a comment 😄

/**
* Navigate to the newly created vault item's detail screen.
*/
data class NavigateToVaultItem(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can we name this to be more specific?

Like CloseAndNavigateToVaultItem,

onNavigateToAttachments: (cipherId: String) -> Unit,
onNavigateToMoveToOrganization: (cipherId: String, showOnlyCollections: Boolean) -> Unit,
onNavigateToPlan: () -> Unit,
onNavigateToVaultItem: (cipherId: String, cipherType: VaultItemCipherType) -> Unit,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Same thing, can we updates the callbacks all the way up to indicate that this closes the screen and navigates to the vault item.

class VaultItemCipherTypeExtensionsTest {

@Test
fun `savedSnackbarMessage should return the correct value for each VaultItemCipherType`() {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

👍

@aj-rosado

Copy link
Copy Markdown
Contributor Author

thanks @david-livefront

@aj-rosado
aj-rosado added this pull request to the merge queue Sep 23, 2026
Merged via the queue into main with commit bf85c77 Sep 23, 2026
27 checks passed
@aj-rosado
aj-rosado deleted the PM-43011/land-on-newly-created-item branch September 23, 2026 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-review Request a Claude code review app:password-manager Bitwarden Password Manager app context t:feature Change Type - Feature Development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants