@@ -27,6 +27,7 @@ import {
2727 enableProfilerTimer ,
2828 enableFundamentalAPI ,
2929 enableScopeAPI ,
30+ enableCache ,
3031} from 'shared/ReactFeatureFlags' ;
3132import { NoFlags , Placement , StaticMask } from './ReactFiberFlags' ;
3233import { ConcurrentRoot , BlockingRoot } from './ReactRootTags' ;
@@ -54,6 +55,7 @@ import {
5455 ScopeComponent ,
5556 OffscreenComponent ,
5657 LegacyHiddenComponent ,
58+ CacheComponent ,
5759} from './ReactWorkTags' ;
5860import getComponentName from 'shared/getComponentName' ;
5961
@@ -88,6 +90,7 @@ import {
8890 REACT_SCOPE_TYPE ,
8991 REACT_OFFSCREEN_TYPE ,
9092 REACT_LEGACY_HIDDEN_TYPE ,
93+ REACT_CACHE_TYPE ,
9194} from 'shared/ReactSymbols' ;
9295
9396export type { Fiber } ;
@@ -501,6 +504,11 @@ export function createFiberFromTypeAndProps(
501504 return createFiberFromScope ( type , pendingProps , mode , lanes , key ) ;
502505 }
503506 // eslint-disable-next-line no-fallthrough
507+ case REACT_CACHE_TYPE :
508+ if ( enableCache ) {
509+ return createFiberFromCache ( pendingProps , mode , lanes , key ) ;
510+ }
511+ // eslint-disable-next-line no-fallthrough
504512 default : {
505513 if ( typeof type === 'object' && type !== null ) {
506514 switch ( type . $$typeof ) {
@@ -745,6 +753,24 @@ export function createFiberFromLegacyHidden(
745753 return fiber ;
746754}
747755
756+ export function createFiberFromCache (
757+ pendingProps : any ,
758+ mode : TypeOfMode ,
759+ lanes : Lanes ,
760+ key : null | string ,
761+ ) {
762+ const fiber = createFiber ( CacheComponent , pendingProps , key , mode ) ;
763+ // TODO: The Cache fiber shouldn't have a type. It has a tag.
764+ // This needs to be fixed in getComponentName so that it relies on the tag
765+ // instead.
766+ if ( __DEV__ ) {
767+ fiber . type = REACT_CACHE_TYPE ;
768+ }
769+ fiber . elementType = REACT_CACHE_TYPE ;
770+ fiber . lanes = lanes ;
771+ return fiber ;
772+ }
773+
748774export function createFiberFromText (
749775 content : string ,
750776 mode : TypeOfMode ,
0 commit comments