1
0
mirror of https://github.com/bitwarden/browser.git synced 2025-02-06 23:51:28 +01:00

partial revert of 374ea6a (#13018)

This commit is contained in:
Jonathan Prusik 2025-01-22 17:08:25 -05:00 committed by GitHub
parent f5744ed28f
commit 649a196e4b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 4 deletions

View File

@ -21,7 +21,7 @@ jest.mock("../utils", () => {
const utils = jest.requireActual("../utils");
return {
...utils,
debounce: jest.fn((fn, wait) => setTimeout(() => fn(), wait)),
debounce: jest.fn((fn) => fn),
};
});

View File

@ -947,8 +947,7 @@ export class CollectAutofillContentService implements CollectAutofillContentServ
}
if (!this.mutationsQueue.length) {
// Collect all mutations and debounce the processing of those mutations by 100ms to ensure we don't process too many mutations at once.
debounce(this.processMutations, 100);
requestIdleCallbackPolyfill(debounce(this.processMutations, 100), { timeout: 500 });
}
this.mutationsQueue.push(mutations);
};

View File

@ -37,7 +37,9 @@ export function requestIdleCallbackPolyfill(
return globalThis.requestIdleCallback(() => callback(), options);
}
return globalThis.setTimeout(() => callback(), 1);
const timeoutDelay = options?.timeout || 1;
return globalThis.setTimeout(() => callback(), timeoutDelay);
}
/**