MCPcopy
hub / github.com/facebook/react / unstable_next

Function unstable_next

packages/scheduler/src/forks/SchedulerPostTask.js:198–220  ·  view source on GitHub ↗
(callback: () => T)

Source from the content-addressed store, hash-verified

196}
197
198export function unstable_next<T>(callback: () => T): T {
199 let priorityLevel: PriorityLevel;
200 switch (currentPriorityLevel_DEPRECATED) {
201 case ImmediatePriority:
202 case UserBlockingPriority:
203 case NormalPriority:
204 // Shift down to normal priority
205 priorityLevel = NormalPriority;
206 break;
207 default:
208 // Anything lower than normal priority should remain at the current level.
209 priorityLevel = currentPriorityLevel_DEPRECATED;
210 break;
211 }
212
213 const previousPriorityLevel = currentPriorityLevel_DEPRECATED;
214 currentPriorityLevel_DEPRECATED = priorityLevel;
215 try {
216 return callback();
217 } finally {
218 currentPriorityLevel_DEPRECATED = previousPriorityLevel;
219 }
220}
221
222export function unstable_wrapCallback<T>(callback: () => T): () => T {
223 const parentPriorityLevel = currentPriorityLevel_DEPRECATED;

Callers

nothing calls this directly

Calls 1

callbackFunction · 0.50

Tested by

no test coverage detected