Skip to content

Commit f9b7ab9

Browse files
committed
backport #3921
1 parent 26a4c28 commit f9b7ab9

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/component.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,16 @@ export function enqueueRender(internal) {
141141
}
142142
}
143143

144+
/**
145+
* @param {import('./internal').Internal} a
146+
* @param {import('./internal').Internal} b
147+
*/
148+
const depthSort = (a, b) => a._depth - b._depth;
149+
144150
/** Flush the render queue by rerendering all queued components */
145151
function processRenderQueue() {
146152
let c;
147-
renderQueue.sort((a, b) => a._depth - b._depth);
153+
renderQueue.sort(depthSort);
148154
// Don't update `renderCount` yet. Keep its value non-zero to prevent unnecessary
149155
// process() calls from getting scheduled while `queue` is still being consumed.
150156
while ((c = renderQueue.shift())) {
@@ -155,7 +161,7 @@ function processRenderQueue() {
155161
// When i.e. rerendering a provider additional new items can be injected, we want to
156162
// keep the order from top to bottom with those new items so we can handle them in a
157163
// single pass
158-
renderQueue.sort((a, b) => a._depth - b._depth);
164+
renderQueue.sort(depthSort);
159165
}
160166
}
161167
}

0 commit comments

Comments
 (0)