Repository navigation
[PM-43847] Add a callout when item-type Sends' items are deleted - #24807
mcamirault wants to merge 2 commits into
Conversation
🤖 Bitwarden Claude Code ReviewOverall Assessment: REQUEST CHANGES This PR adds an info callout to the Send form when an item-type Send's cipher is no longer in the user's decrypted vault. It also adds the matching i18n keys to the browser, desktop, and web locale files. The earlier Code Review Details
|
| toObservable(this.sendFormService.originalSendView), | ||
| this.accountService.activeAccount$.pipe( | ||
| getUserId, | ||
| switchMap((userId) => this.cipherService.cipherViews$(userId)), |
There was a problem hiding this comment.
cipherViews$ emits null whenever the cipher cache is cleared, so cipherViews.some(...) on line 138 throws a TypeError.
Details and fix
cipherViews$ is built with perUserCache$(..., this.clearCipherViewsForUser$). CipherService.clearCache() pushes null through it (cipher.service.ts:274-277, "Force the cached cipherView$ observable(s) to emit a null value"). The implementation's documented type is Observable<CipherView[] | null>, where null means decryption is in progress. The abstract signature says CipherView[], and @ts-strict-ignore hides the mismatch here.
clearCache runs on sync and on cipher writes. A background sync while an item-type Send is open in edit mode is enough. Because the cache uses shareReplay({ refCount: false }), a subscriber can also get the replayed null as its first value if no decrypt has finished since the last clear. When map throws, the stream errors and AsyncPipe rethrows it as an uncaught exception. The callout then stays dead for the rest of the component's life.
Drop the in-progress null instead of mapping it to "not deleted". That also keeps the callout from flickering while the vault re-decrypts. CipherService.cipherView$ already does this:
| switchMap((userId) => this.cipherService.cipherViews$(userId)), | |
| switchMap((userId) => this.cipherService.cipherViews$(userId).pipe(filterOutNullish())), |
filterOutNullish comes from @bitwarden/common/vault/utils/observable-utilities.
code-review
🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-43847
📔 Objective
This PR adds a callout that is only displayed when the item that an item-type Send is sharing has been deleted. Such Sends have their access locked immediately but aren't removed until the next time the automated cleanup job runs (the job runs every five minutes); this callout notifies the user of this state in case they look at the Send before it is deleted.
Should be tested and considered in conjunction with this server PR
📸 Screenshots