Skip to content

[PM-41957] fix: Show New folder created toast on all folder creation paths - #2991

Open
andrebispo5 wants to merge 5 commits into
mainfrom
pm-41957-new-folder-added-snackbar
Open

[PM-41957] fix: Show New folder created toast on all folder creation paths#2991
andrebispo5 wants to merge 5 commits into
mainfrom
pm-41957-new-folder-added-snackbar

Conversation

@andrebispo5

@andrebispo5 andrebispo5 commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

🎟️ Tracking

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

📔 Objective

Creating a folder only told you it worked in one of the three places you can do it.

  • Settings > Folders showed the "New folder created." toast. The item editor's folder picker and the vault list's add-folder button showed nothing.
  • The item editor selected the new folder but never set a toast.
  • The vault list wasn't passing itself as the delegate, so nothing was listening.
  • The vault list also wiped the toast on every refresh. It cleared it to dismiss the "This is taking longer than expected" message, and since the vault list watches folders, creating one triggered a refresh that killed the toast a moment after it appeared. Now only that one toast gets dismissed, which also fixes the item deleted/archived/restored toasts that were losing the same race.
  • Fixed the swapped folderDeleted/folderEdited doc comments on the delegate protocol while I was in there.

📸 Screenshots

Screen.Recording.2026-08-25.at.13.17.35.mov

@github-actions github-actions Bot added app:password-manager Bitwarden Password Manager app context t:bug Change Type - Bug labels Aug 25, 2026
@codecov

codecov Bot commented Aug 25, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 79.52%. Comparing base (c419835) to head (d6afc9d).

Files with missing lines Patch % Lines
.../UI/Vault/Vault/VaultList/VaultListProcessor.swift 95.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2991      +/-   ##
==========================================
- Coverage   79.53%   79.52%   -0.01%     
==========================================
  Files        1169     1169              
  Lines       75095    75112      +17     
==========================================
+ Hits        59724    59733       +9     
- Misses      15371    15379       +8     

☔ 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.

@andrebispo5
andrebispo5 marked this pull request as ready for review August 25, 2026 12:19
@andrebispo5
andrebispo5 requested review from a team and matt-livefront as code owners August 25, 2026 12:19
Copilot AI lite review requested due to automatic review settings August 25, 2026 12:19
@github-actions

github-actions Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

🤖 Bitwarden Claude Code Review

Overall Assessment: APPROVE

Reviewed the four commits that make the "New folder created." toast appear on all three folder-creation paths. The VaultCoordinator.showAddFolder(delegate:) change matches the existing VaultItemCoordinator pattern, and the new AddEditFolderDelegate conformance on VaultListProcessor correctly no-ops the delete/edit callbacks that aren't reachable from the vault list. The dismissSlowLoadingToast() narrowing is sound: Toast.== compares only title/subtitle (excluding id and mode), so the guard reliably matches the slow-loading toast while leaving folder/item toasts in place, and moving takingTimeTask.cancel() ahead of the dismissal in the defer removes the previous ordering hazard. Test coverage accompanies each behavior change, and the swapped folderDeleted/folderEdited doc comments are now accurate.

Code Review Details

No findings.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes inconsistent user feedback when creating folders by ensuring the “New folder created.” toast appears across all folder-creation entry points (settings, item editor folder picker, and vault list), and by preventing vault refresh flows from clearing unrelated toasts prematurely.

Changes:

  • Show the folder-created toast when a folder is added via the item editor’s folder picker.
  • Wire the vault list into the add-folder flow as an AddEditFolderDelegate so it can display the folder-created toast.
  • Prevent vault refresh/stream updates from dismissing unrelated toasts by only dismissing the specific slow-loading toast.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
BitwardenShared/UI/Vault/VaultItem/AddEditItem/AddEditItemProcessorTests.swift Expands folderAdded(_:) test coverage to assert the folder-created toast is shown.
BitwardenShared/UI/Vault/VaultItem/AddEditItem/AddEditItemProcessor.swift Sets the folder-created toast when a new folder is added from the item editor flow.
BitwardenShared/UI/Vault/Vault/VaultList/VaultListProcessorTests.swift Adds tests for vault list folder delegate behavior and for preserving unrelated toasts across refresh/stream updates.
BitwardenShared/UI/Vault/Vault/VaultList/VaultListProcessor.swift Passes self as add-folder delegate, adds slow-loading toast dismissal scoping, and implements AddEditFolderDelegate to show folder-created toast.
BitwardenShared/UI/Vault/Vault/VaultCoordinatorTests.swift Verifies delegate propagation behavior when navigating to add-folder with/without context.
BitwardenShared/UI/Vault/Vault/VaultCoordinator.swift Passes an optional AddEditFolderDelegate through to the add/edit folder coordinator.
BitwardenShared/UI/Platform/Settings/Settings/Vault/Folders/AddEditFolder/AddEditFolder/AddEditFolderProcessor.swift Fixes swapped doc comments for folderDeleted() / folderEdited() in the delegate protocol.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.


extension VaultListProcessor: AddEditFolderDelegate {
func folderAdded(_: FolderView) {
state.toast = Toast(title: Localizations.folderCreated)

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.

🤔 One thing I noticed is that if this toast is displayed while the "This is taking longer than expected" toast is visible, the "New folder created" toast is never dismissed.

Simulator.Screen.Recording.-.iPhone.17.Pro.-.2026-08-26.at.10.06.10.mov

This might be an existing bug introduced by this: https://github.com/bitwarden/ios/pull/2827/changes#diff-68b12b1d47e8d01df3d910e70d76c1ba459cafe2c142501b36a2febad412be45. Any idea if we can fix this, revert that change, or switch the task to onChange(of:)?

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.

Good catch, thanks. The root cause was in ToastView rather than here:

  • The .task running the dismiss timer had no id, and .id(toast.id) sits further in on the VStack, so swapping state.toast for a different toast never restarted it.
  • The task that did run started while the manual dismiss toast was up, hit the guard mode == .automaticDismiss and returned, so the "New folder created" toast ended up with no timer at all.
  • Changed it to .task(id: toast.id) in 87458dd. That also fixes a second case where one automatic toast replacing another inherited the first's leftover time and could disappear almost immediately.

Verified in the simulator with both toasts in sequence.

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.

Screen.Recording.2026-08-27.at.12.18.37.mov

@github-actions github-actions Bot added the app:authenticator Bitwarden Authenticator app context label Aug 27, 2026
@andrebispo5
andrebispo5 force-pushed the pm-41957-new-folder-added-snackbar branch from 87458dd to d6afc9d Compare August 27, 2026 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app:authenticator Bitwarden Authenticator app context app:password-manager Bitwarden Password Manager app context t:bug Change Type - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants