[PM-31181] fix: Toast displays after view/edit cipher actions#2586
Conversation
…ast displays after view/edit cipher actions
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2586 +/- ##
==========================================
+ Coverage 87.20% 87.22% +0.01%
==========================================
Files 1895 1895
Lines 167767 167743 -24
==========================================
+ Hits 146304 146306 +2
+ Misses 21463 21437 -26 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
🤖 Bitwarden Claude Code ReviewOverall Assessment: APPROVE Reviewed the toast-after-cipher-action fix, which addresses a SwiftUI/UIKit teardown race where Code Review DetailsNo findings. The capture-list pattern is correct (the strongly-captured optional weak reference is released when the closure is released, which is short-lived and owned by |
🎟️ Tracking
PM-31181
📔 Objective
When a user performs an action (archive, soft delete, permanent delete, restore, unarchive) on the view or edit cipher screen, no toast was displayed after the screen dismissed.
Root cause: All
DismissActioncompletion blocks inViewItemProcessorandAddEditItemProcessorcapturedselfweakly via[weak self]. SwiftUI tears down the view hierarchy (and deallocates the processor) before UIKit fires the dismiss-animation completion, soselfis nil by the time the block runs — meaningCipherItemOperationDelegatecallbacks are never called and no toast appears. The triple-dot menu was unaffected because it calls the toast handler directly without a dismiss completion.Fix: Capture
delegateas a strong localletimmediately before navigating to dismiss, so theDismissActionclosure no longer needsselfat all. No retain cycle is introduced — the processor does not own theDismissAction.Additionally, the previously unused
performOperationAndDismisshelper was corrected (changedonDismissfrom(ViewItemProcessor) -> Voidto() -> Void) and is now used bypermanentDeleteItem,softDeleteItem, andrestoreItemto remove duplicated loading-overlay boilerplate.