Skip to content

Commit 01b9482

Browse files
Hoist depth sorting function
1 parent da7c661 commit 01b9482

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/component.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,13 @@ export function enqueueRender(internal) {
139139
}
140140
}
141141

142+
/** @type {(a: import('./internal').Internal, b: import("./internal").Internal) => number} */
143+
const sortByDepth = (a, b) => a._depth - b._depth;
144+
142145
/** Flush the render queue by rerendering all queued components */
143146
function processRenderQueue() {
144147
while ((len = processRenderQueue._rerenderCount = renderQueue.length)) {
145-
renderQueue.sort((a, b) => a._depth - b._depth);
148+
renderQueue.sort(sortByDepth);
146149
while (len--) {
147150
renderQueuedInternal(renderQueue.shift());
148151
}

0 commit comments

Comments
 (0)