mirror of
https://github.com/bitwarden/browser.git
synced 2025-01-24 21:41:33 +01:00
[PM-5189] Fixing an issue found when switching between open windows
This commit is contained in:
parent
b9c18b5526
commit
a44f594e6d
@ -163,7 +163,7 @@ export class OverlayBackground implements OverlayBackgroundInterface {
|
||||
private initOverlayEventObservables() {
|
||||
this.repositionInlineMenuSubject
|
||||
.pipe(
|
||||
debounceTime(950),
|
||||
debounceTime(1000),
|
||||
switchMap((sender) => this.repositionInlineMenu(sender)),
|
||||
)
|
||||
.subscribe();
|
||||
@ -176,7 +176,7 @@ export class OverlayBackground implements OverlayBackgroundInterface {
|
||||
|
||||
// Debounce used to update inline menu position
|
||||
merge(
|
||||
this.startUpdateInlineMenuPositionSubject.pipe(debounceTime(250)),
|
||||
this.startUpdateInlineMenuPositionSubject.pipe(debounceTime(150)),
|
||||
this.cancelUpdateInlineMenuPositionSubject,
|
||||
)
|
||||
.pipe(switchMap((sender) => this.updateInlineMenuPositionAfterRepositionEvent(sender)))
|
||||
@ -216,6 +216,9 @@ export class OverlayBackground implements OverlayBackgroundInterface {
|
||||
async updateInlineMenuCiphers() {
|
||||
const authStatus = await firstValueFrom(this.authService.activeAccountStatus$);
|
||||
if (authStatus !== AuthenticationStatus.Unlocked) {
|
||||
if (this.focusedFieldData) {
|
||||
void this.closeInlineMenuAfterCiphersUpdate();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@ -224,6 +227,10 @@ export class OverlayBackground implements OverlayBackgroundInterface {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.focusedFieldData && currentTab.id !== this.focusedFieldData.tabId) {
|
||||
void this.closeInlineMenuAfterCiphersUpdate();
|
||||
}
|
||||
|
||||
this.inlineMenuCiphers = new Map();
|
||||
const ciphersViews = (await this.cipherService.getAllDecryptedForUrl(currentTab.url)).sort(
|
||||
(a, b) => this.cipherService.sortCiphersByLastUsedThenName(a, b),
|
||||
@ -266,6 +273,11 @@ export class OverlayBackground implements OverlayBackgroundInterface {
|
||||
return inlineMenuCipherData;
|
||||
}
|
||||
|
||||
private async closeInlineMenuAfterCiphersUpdate() {
|
||||
const focusedFieldTab = await BrowserApi.getTab(this.focusedFieldData.tabId);
|
||||
this.closeInlineMenu({ tab: focusedFieldTab }, { forceCloseInlineMenu: true });
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles aggregation of page details for a tab. Stores the page details
|
||||
* in association with the tabId of the tab that sent the message.
|
||||
|
@ -94,7 +94,7 @@ export default class TabsBackground {
|
||||
return;
|
||||
}
|
||||
|
||||
await this.overlayBackground.updateInlineMenuCiphers();
|
||||
this.overlayBackground.updateInlineMenuCiphers();
|
||||
|
||||
if (this.main.onUpdatedRan) {
|
||||
return;
|
||||
@ -121,10 +121,7 @@ export default class TabsBackground {
|
||||
* for the current tab. Also updates the overlay ciphers.
|
||||
*/
|
||||
private updateCurrentTabData = async () => {
|
||||
await Promise.all([
|
||||
this.main.refreshBadge(),
|
||||
this.main.refreshMenu(),
|
||||
this.overlayBackground.updateInlineMenuCiphers(),
|
||||
]);
|
||||
this.overlayBackground.updateInlineMenuCiphers();
|
||||
await Promise.all([this.main.refreshBadge(), this.main.refreshMenu()]);
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user