Skip to content

Commit f157d8c

Browse files
[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 <[email protected]>
1 parent 5a37431 commit f157d8c

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

apps/browser/src/vault/popup/services/vault-popup-autofill.service.spec.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ describe("VaultPopupAutofillService", () => {
125125
});
126126

127127
it("should only fetch the current tab once when subscribed to multiple times", async () => {
128+
(BrowserApi.getTabFromCurrentWindow as jest.Mock).mockClear();
129+
130+
service.refreshCurrentTab();
131+
128132
const firstTracked = subscribeTo(service.currentAutofillTab$);
129133
const secondTracked = subscribeTo(service.currentAutofillTab$);
130134

@@ -195,6 +199,7 @@ describe("VaultPopupAutofillService", () => {
195199

196200
// Refresh the current tab so the mockedPageDetails$ are used
197201
service.refreshCurrentTab();
202+
(service as any)._currentPageDetails$ = of(mockPageDetails);
198203
});
199204

200205
describe("doAutofill()", () => {

apps/browser/src/vault/popup/services/vault-popup-autofill.service.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { Injectable } from "@angular/core";
44
import { ActivatedRoute } from "@angular/router";
55
import {
66
combineLatest,
7+
debounceTime,
78
firstValueFrom,
89
map,
910
Observable,
@@ -164,6 +165,7 @@ export class VaultPopupAutofillService {
164165
}),
165166
);
166167
}),
168+
debounceTime(50),
167169
shareReplay({ refCount: false, bufferSize: 1 }),
168170
);
169171

0 commit comments

Comments
 (0)