Skip to content

Commit

Permalink
options.requestAnimationFrame solves it
Browse files Browse the repository at this point in the history
  • Loading branch information
JoviDeCroock committed Oct 5, 2024
1 parent 2bc881b commit 29cb98d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/preact/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ function flushEffects() {

function notifyEffects(this: Effect) {
if (effectsQueue.push(this) === 1) {
(options.debounceRendering || defer)(flushEffects);
(options.requestAnimationFrame || defer)(flushEffects);
}
}

Expand All @@ -394,7 +394,7 @@ function flushComputeds() {

function notifyComputeds(this: Effect) {
if (computedsQueue.push(this) === 1) {
(options.debounceRendering || defer)(flushComputeds);
(options.requestAnimationFrame || defer)(flushComputeds);
}
}

Expand Down
3 changes: 1 addition & 2 deletions packages/preact/test/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const afterFrame = () => {
});
};

describe.only("@preact/signals", () => {
describe("@preact/signals", () => {
let scratch: HTMLDivElement;
let rerender: () => void;

Expand Down Expand Up @@ -756,7 +756,6 @@ describe.only("@preact/signals", () => {
render(<App />, scratch);
});

await afterFrame();
expect(cleanup).not.to.have.been.called;
expect(spy).to.have.been.calledOnceWith(
"foo",
Expand Down

0 comments on commit 29cb98d

Please sign in to comment.