@@ -171,6 +171,7 @@ export function getInternalReactConstants(
171
171
// Currently the version in Git is 17.0.2 (but that version has not been/may not end up being released).
172
172
if ( gt ( version , '17.0.1' ) ) {
173
173
ReactTypeOfWork = {
174
+ CacheComponent : 24 , // Experimental
174
175
ClassComponent : 1 ,
175
176
ContextConsumer : 9 ,
176
177
ContextProvider : 10 ,
@@ -200,6 +201,7 @@ export function getInternalReactConstants(
200
201
} ;
201
202
} else if ( gte ( version , '17.0.0-alpha' ) ) {
202
203
ReactTypeOfWork = {
204
+ CacheComponent : - 1 , // Doens't exist yet
203
205
ClassComponent : 1 ,
204
206
ContextConsumer : 9 ,
205
207
ContextProvider : 10 ,
@@ -229,6 +231,7 @@ export function getInternalReactConstants(
229
231
} ;
230
232
} else if ( gte ( version , '16.6.0-beta.0' ) ) {
231
233
ReactTypeOfWork = {
234
+ CacheComponent : - 1 , // Doens't exist yet
232
235
ClassComponent : 1 ,
233
236
ContextConsumer : 9 ,
234
237
ContextProvider : 10 ,
@@ -258,6 +261,7 @@ export function getInternalReactConstants(
258
261
} ;
259
262
} else if ( gte ( version , '16.4.3-alpha' ) ) {
260
263
ReactTypeOfWork = {
264
+ CacheComponent : - 1 , // Doens't exist yet
261
265
ClassComponent : 2 ,
262
266
ContextConsumer : 11 ,
263
267
ContextProvider : 12 ,
@@ -287,6 +291,7 @@ export function getInternalReactConstants(
287
291
} ;
288
292
} else {
289
293
ReactTypeOfWork = {
294
+ CacheComponent : - 1 , // Doens't exist yet
290
295
ClassComponent : 2 ,
291
296
ContextConsumer : 12 ,
292
297
ContextProvider : 13 ,
@@ -330,6 +335,7 @@ export function getInternalReactConstants(
330
335
}
331
336
332
337
const {
338
+ CacheComponent,
333
339
ClassComponent,
334
340
IncompleteClassComponent,
335
341
FunctionComponent,
@@ -377,6 +383,8 @@ export function getInternalReactConstants(
377
383
let resolvedContext : any = null ;
378
384
379
385
switch ( tag ) {
386
+ case CacheComponent :
387
+ return 'Cache' ;
380
388
case ClassComponent :
381
389
case IncompleteClassComponent :
382
390
return getDisplayName ( resolvedType ) ;
@@ -481,12 +489,13 @@ export function attach(
481
489
} = getInternalReactConstants ( renderer . version ) ;
482
490
const { NoFlags, PerformedWork, Placement} = ReactTypeOfSideEffect ;
483
491
const {
484
- FunctionComponent ,
492
+ CacheComponent ,
485
493
ClassComponent,
486
494
ContextConsumer,
487
495
DehydratedSuspenseComponent,
488
- Fragment,
489
496
ForwardRef,
497
+ Fragment,
498
+ FunctionComponent,
490
499
HostRoot,
491
500
HostPortal,
492
501
HostComponent,
@@ -2330,6 +2339,10 @@ export function attach(
2330
2339
tag === ForwardRef ) &&
2331
2340
( ! ! memoizedState || ! ! dependencies ) ;
2332
2341
2342
+ // TODO Show custom UI for Cache like we do for Suspense
2343
+ // For now, just hide state data entirely since it's not meant to be inspected.
2344
+ const showState = ! usesHooks && tag !== CacheComponent ;
2345
+
2333
2346
const typeSymbol = getTypeSymbol ( type ) ;
2334
2347
2335
2348
let canViewSource = false ;
@@ -2496,7 +2509,7 @@ export function attach(
2496
2509
context ,
2497
2510
hooks ,
2498
2511
props : memoizedProps ,
2499
- state : usesHooks ? null : memoizedState ,
2512
+ state : showState ? memoizedState : null ,
2500
2513
2501
2514
// List of owners
2502
2515
owners ,
0 commit comments