Skip to content

Commit

Permalink
refactor(core): avoid additional closure for queued microtask callback (
Browse files Browse the repository at this point in the history
#54801)

The `runCallbackOnce` closure is declared not to have any parameters itself, so it is
compatible as `queueMicrotask` callback without the extra closure. This reduces the call
stack by a frame and avoids the extra closure allocation.

PR Close #54801
  • Loading branch information
JoostK authored and atscott committed Mar 11, 2024
1 parent fa315d4 commit d269c88
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions packages/core/src/render3/queue_state_update.ts
Expand Up @@ -40,7 +40,5 @@ export function queueStateUpdate(callback: VoidFunction, options?: {injector?: I
};

internalAfterNextRender(runCallbackOnce, {injector, runOnServer: true});
queueMicrotask(() => {
runCallbackOnce();
});
queueMicrotask(runCallbackOnce);
}

0 comments on commit d269c88

Please sign in to comment.