File tree Expand file tree Collapse file tree 2 files changed +14
-15
lines changed
packages/react-ape/renderer Expand file tree Collapse file tree 2 files changed +14
-15
lines changed Original file line number Diff line number Diff line change @@ -22,20 +22,20 @@ function renderApeQueue(
2222 onFinish : ( ) = > mixed
2323) {
2424 if ( apeContextGlobal && apeContextGlobal . renderQueue . length ) {
25- // const renderFrame = () => {
26- // requestAnimationFrame(renderFrame);
27- // apeContextGlobal.renderQueue.forEach(element => {
28- // // element.render(apeContextGlobal, element.parentLayout)
29- // renderApeElement(apeContextGlobal, element);
30- // });
31- // cancelAnimationFrame(renderFrame);
32- // }
33- // renderFrame();
25+ const queue = apeContextGlobal . renderQueue ;
26+ const frame = ( ) => {
27+ requestAnimationFrame ( frame ) ;
28+ const element = queue . shift ( ) ;
29+ element . render ( apeContextGlobal , element . parentLayout ) ;
3430
35- apeContextGlobal . renderQueue . forEach ( element => {
36- renderApeElement ( apeContextGlobal , element ) ;
37- } ) ;
38- onFinish ( ) ;
31+ requestAnimationFrame ( frame ) ;
32+
33+ if ( ! queue . length ) {
34+ cancelAnimationFrame ( frame ) ;
35+ onFinish ( ) ;
36+ }
37+ }
38+ frame ( ) ;
3939 }
4040}
4141
Original file line number Diff line number Diff line change @@ -164,7 +164,6 @@ const ReactApeFiber = reconciler({
164164 // resetAfterCommit happens only for children changes
165165 renderQueue ( apeContextGlobal , ( ) => {
166166 apeContextGlobal . setSurfaceHeight ( 0 ) ;
167- apeContextGlobal . renderQueue = [ ] ;
168167 } ) ;
169168 } ,
170169
@@ -187,7 +186,7 @@ const ReactApeFiber = reconciler({
187186 schedulePassiveEffects : FrameSchedulingScheduleDeferredCallback ,
188187 cancelPassiveEffects : FrameSchedulingCancelDeferredCallback ,
189188 noTimeout : - 1 ,
190- useSyncScheduling : true ,
189+ useSyncScheduling : false ,
191190 now : FrameSchedulingNow ,
192191 isPrimaryRenderer : true ,
193192 supportsMutation : true ,
You can’t perform that action at this time.
0 commit comments