MCPcopy Index your code
hub / github.com/react/react / switch

Function switch

packages/react-reconciler/src/ReactFiberHooks.js:3513–3550  ·  view source on GitHub ↗
(provider.tag)

Source from the content-addressed store, hash-verified

3511 let provider = fiber.return;
3512 while (provider !== null) {
3513 switch (provider.tag) {
3514 case CacheComponent:
3515 case HostRoot: {
3516 // Schedule an update on the cache boundary to trigger a refresh.
3517 const lane = requestUpdateLane(provider);
3518 const refreshUpdate = createLegacyQueueUpdate(lane);
3519 const root = enqueueLegacyQueueUpdate(provider, refreshUpdate, lane);
3520 if (root !== null) {
3521 startUpdateTimerByLane(lane, 'refresh()', fiber);
3522 scheduleUpdateOnFiber(root, provider, lane);
3523 entangleLegacyQueueTransitions(root, provider, lane);
3524 }
3525
3526 // TODO: If a refresh never commits, the new cache created here must be
3527 // released. A simple case is start refreshing a cache boundary, but then
3528 // unmount that boundary before the refresh completes.
3529 const seededCache = createCache();
3530 if (seedKey !== null && seedKey !== undefined && root !== null) {
3531 if (enableLegacyCache) {
3532 // Seed the cache with the value passed by the caller. This could be
3533 // from a server mutation, or it could be a streaming response.
3534 seededCache.data.set(seedKey, seedValue);
3535 } else {
3536 if (__DEV__) {
3537 console.error(
3538 'The seed argument is not enabled outside experimental channels.',
3539 );
3540 }
3541 }
3542 }
3543
3544 const payload = {
3545 cache: seededCache,
3546 };
3547 refreshUpdate.payload = payload;
3548 return;
3549 }
3550 }
3551 provider = provider.return;
3552 }
3553 // TODO: Warn if unmounted?

Callers

nothing calls this directly

Calls 6

requestUpdateLaneFunction · 0.90
startUpdateTimerByLaneFunction · 0.90
scheduleUpdateOnFiberFunction · 0.90
createCacheFunction · 0.90
setMethod · 0.80
errorMethod · 0.65

Tested by

no test coverage detected