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
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.
  • Loading branch information
JoostK committed Mar 11, 2024
1 parent e9223ef commit 6f7843c
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 6f7843c

Please sign in to comment.