()
| 12032 | } |
| 12033 | } |
| 12034 | function flushSyncCallbacks() { |
| 12035 | if (!isFlushingSyncQueue && syncQueue !== null) { |
| 12036 | // Prevent re-entrance. |
| 12037 | isFlushingSyncQueue = true; |
| 12038 | var i = 0; |
| 12039 | var previousUpdatePriority = getCurrentUpdatePriority(); |
| 12040 | |
| 12041 | try { |
| 12042 | var isSync = true; |
| 12043 | var queue = syncQueue; // TODO: Is this necessary anymore? The only user code that runs in this |
| 12044 | // queue is in the render or commit phases. |
| 12045 | |
| 12046 | setCurrentUpdatePriority(DiscreteEventPriority); |
| 12047 | |
| 12048 | for (; i < queue.length; i++) { |
| 12049 | var callback = queue[i]; |
| 12050 | |
| 12051 | do { |
| 12052 | callback = callback(isSync); |
| 12053 | } while (callback !== null); |
| 12054 | } |
| 12055 | |
| 12056 | syncQueue = null; |
| 12057 | includesLegacySyncCallbacks = false; |
| 12058 | } catch (error) { |
| 12059 | // If something throws, leave the remaining callbacks on the queue. |
| 12060 | if (syncQueue !== null) { |
| 12061 | syncQueue = syncQueue.slice(i + 1); |
| 12062 | } // Resume flushing in the next tick |
| 12063 | |
| 12064 | |
| 12065 | scheduleCallback(ImmediatePriority, flushSyncCallbacks); |
| 12066 | throw error; |
| 12067 | } finally { |
| 12068 | setCurrentUpdatePriority(previousUpdatePriority); |
| 12069 | isFlushingSyncQueue = false; |
| 12070 | } |
| 12071 | } |
| 12072 | |
| 12073 | return null; |
| 12074 | } |
| 12075 | |
| 12076 | // TODO: Use the unified fiber stack module instead of this local one? |
| 12077 | // Intentionally not using it yet to derisk the initial implementation, because |
no test coverage detected
searching dependent graphs…