Skip to content

Commit

Permalink
partial revert of 374ea6a (#13018)
Browse files Browse the repository at this point in the history
  • Loading branch information
jprusik authored Jan 22, 2025
1 parent f5744ed commit 649a196
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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),
};
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
Expand Down
4 changes: 3 additions & 1 deletion apps/browser/src/autofill/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down

0 comments on commit 649a196

Please sign in to comment.