Skip to content

Commit

Permalink
partial revert of 374ea6a
Browse files Browse the repository at this point in the history
  • Loading branch information
jprusik committed Jan 22, 2025
1 parent a949f79 commit 210f97c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 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 @@ -948,7 +948,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);

Check warning on line 42 in apps/browser/src/autofill/utils/index.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/autofill/utils/index.ts#L42

Added line #L42 was not covered by tests
}

/**
Expand Down

0 comments on commit 210f97c

Please sign in to comment.