@@ -218,7 +218,7 @@ const visitLoop = (
218218 const errorFrame = getCurrentErrorFrame ( )
219219 if ( ! errorFrame ) throw error
220220 errorFrame . error = error
221- queue . push ( errorFrame )
221+ queue . unshift ( errorFrame )
222222 return false
223223 } finally {
224224 ReactCurrentDispatcher . current = prevDispatcher
@@ -247,8 +247,6 @@ export const visit = (
247247 queue : Frame [ ] ,
248248 visitor : Visitor
249249) => {
250- if ( ! init . length ) return
251-
252250 const traversalChildren : AbstractElement [ ] [ ] = [ init ]
253251 const traversalMap : Array < void | ContextMap > = [ flushPrevContextMap ( ) ]
254252 const traversalStore : Array < void | ContextEntry > = [ flushPrevContextStore ( ) ]
@@ -305,9 +303,9 @@ export const update = (frame: Frame, queue: Frame[], visitor: Visitor) => {
305303 const prevDispatcher = ReactCurrentDispatcher . current
306304 let children = null
307305
308- try {
309- ReactCurrentDispatcher . current = Dispatcher
306+ ReactCurrentDispatcher . current = Dispatcher
310307
308+ try {
311309 if ( frame . kind === 'frame . class ') {
312310 children = updateClassComponent ( queue , frame)
313311 } else if ( frame . kind === 'frame.hooks' ) {
@@ -319,7 +317,7 @@ export const update = (frame: Frame, queue: Frame[], visitor: Visitor) => {
319317 const errorFrame = getCurrentErrorFrame ( )
320318 if ( ! errorFrame ) throw error
321319 errorFrame . error = error
322- queue . push ( errorFrame )
320+ queue . unshift ( errorFrame )
323321 children = null
324322 } finally {
325323 ReactCurrentDispatcher . current = prevDispatcher
0 commit comments