1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-11 22:03:36 +00:00

[PM-24710] Add a debounceTime to autofill currentPageDetails (#16029)

* [PM-24710] Add a debounceTime to currentPageDetails to ensure details collection content script has enough time to collect for details

* Adjust test observables to account for debounce

---------

Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
This commit is contained in:
Shane Melton
2025-08-15 08:07:59 -07:00
committed by GitHub
parent 0c842b2973
commit e7a55d3395
2 changed files with 7 additions and 0 deletions

View File

@@ -125,6 +125,10 @@ describe("VaultPopupAutofillService", () => {
}); });
it("should only fetch the current tab once when subscribed to multiple times", async () => { it("should only fetch the current tab once when subscribed to multiple times", async () => {
(BrowserApi.getTabFromCurrentWindow as jest.Mock).mockClear();
service.refreshCurrentTab();
const firstTracked = subscribeTo(service.currentAutofillTab$); const firstTracked = subscribeTo(service.currentAutofillTab$);
const secondTracked = subscribeTo(service.currentAutofillTab$); const secondTracked = subscribeTo(service.currentAutofillTab$);
@@ -195,6 +199,7 @@ describe("VaultPopupAutofillService", () => {
// Refresh the current tab so the mockedPageDetails$ are used // Refresh the current tab so the mockedPageDetails$ are used
service.refreshCurrentTab(); service.refreshCurrentTab();
(service as any)._currentPageDetails$ = of(mockPageDetails);
}); });
describe("doAutofill()", () => { describe("doAutofill()", () => {

View File

@@ -4,6 +4,7 @@ import { Injectable } from "@angular/core";
import { ActivatedRoute } from "@angular/router"; import { ActivatedRoute } from "@angular/router";
import { import {
combineLatest, combineLatest,
debounceTime,
firstValueFrom, firstValueFrom,
map, map,
Observable, Observable,
@@ -164,6 +165,7 @@ export class VaultPopupAutofillService {
}), }),
); );
}), }),
debounceTime(50),
shareReplay({ refCount: false, bufferSize: 1 }), shareReplay({ refCount: false, bufferSize: 1 }),
); );