import { UpdateQueue as HookQueue } from './ReactFiberHooks' ; let interleavedQueues = null ; param queue export const pushInterleavedQueue = ( queue ) => { if ( interleavedQueues === null ) { interleavedQueues = [ queue ] ; } else { interleavedQueues . push ( queue ) ; } } ; /**
 * 将interleaved queue中的update转移到pending queue中
 * 该队列形成的条件可以看react-reconciler\ReactFiberHooks.ts下的
 * dispatchAction
 */ export const enqueueInterleavedUpdates = ( ) => { if ( interleavedQueues !== null ) { for ( let i = 0 ; i < interleavedQueues . length ; ++ i ) { const queue = interleavedQueues [ i ] ; const lastInterleavedUpdate = queue . interleaved ; if ( lastInterleavedUpdate !== null ) { queue . interleaved = null ; const firstInterleavedUpdate = lastInterleavedUpdate . next ; const lastPendingUpdate = queue . pending ; if ( lastPendingUpdate !== null ) { const firstPendingUpdate = lastPendingUpdate . next ; lastPendingUpdate . next = firstInterleavedUpdate ; lastInterleavedUpdate . next = firstPendingUpdate ; } queue . pending = lastInterleavedUpdate ; } } interleavedQueues = null ; } } ;