@@ -546,6 +546,7 @@ describe('ReactHooksInspectionIntegration', () => {
546
546
function Foo ( props ) {
547
547
React . useTransition ( ) ;
548
548
const memoizedValue = React . useMemo ( ( ) => 'hello' , [ ] ) ;
549
+ React . useMemo ( ( ) => 'not used' , [ ] ) ;
549
550
return < div > { memoizedValue } </ div > ;
550
551
}
551
552
const renderer = ReactTestRenderer . create ( < Foo /> ) ;
@@ -566,16 +567,24 @@ describe('ReactHooksInspectionIntegration', () => {
566
567
value : 'hello' ,
567
568
subHooks : [ ] ,
568
569
} ,
570
+ {
571
+ id : 2 ,
572
+ isStateEditable : false ,
573
+ name : 'Memo' ,
574
+ value : 'not used' ,
575
+ subHooks : [ ] ,
576
+ } ,
569
577
] ) ;
570
578
} ) ;
571
579
572
- it ( 'should support composite useDeferredValue hook' , ( ) => {
580
+ it ( 'should support useDeferredValue hook' , ( ) => {
573
581
function Foo ( props ) {
574
582
React . useDeferredValue ( 'abc' , {
575
583
timeoutMs : 500 ,
576
584
} ) ;
577
- const [ state ] = React . useState ( ( ) => 'hello' , [ ] ) ;
578
- return < div > { state } </ div > ;
585
+ const memoizedValue = React . useMemo ( ( ) => 1 , [ ] ) ;
586
+ React . useMemo ( ( ) => 2 , [ ] ) ;
587
+ return < div > { memoizedValue } </ div > ;
579
588
}
580
589
const renderer = ReactTestRenderer . create ( < Foo /> ) ;
581
590
const childFiber = renderer . root . findByType ( Foo ) . _currentFiber ( ) ;
@@ -590,9 +599,16 @@ describe('ReactHooksInspectionIntegration', () => {
590
599
} ,
591
600
{
592
601
id : 1 ,
593
- isStateEditable : true ,
594
- name : 'State' ,
595
- value : 'hello' ,
602
+ isStateEditable : false ,
603
+ name : 'Memo' ,
604
+ value : 1 ,
605
+ subHooks : [ ] ,
606
+ } ,
607
+ {
608
+ id : 2 ,
609
+ isStateEditable : false ,
610
+ name : 'Memo' ,
611
+ value : 2 ,
596
612
subHooks : [ ] ,
597
613
} ,
598
614
] ) ;
@@ -1012,6 +1028,7 @@ describe('ReactHooksInspectionIntegration', () => {
1012
1028
( ) => { } ,
1013
1029
) ;
1014
1030
React . useMemo ( ( ) => 'memo' , [ ] ) ;
1031
+ React . useMemo ( ( ) => 'not used' , [ ] ) ;
1015
1032
return < div /> ;
1016
1033
}
1017
1034
const renderer = ReactTestRenderer . create ( < Foo /> ) ;
@@ -1032,6 +1049,13 @@ describe('ReactHooksInspectionIntegration', () => {
1032
1049
value : 'memo' ,
1033
1050
subHooks : [ ] ,
1034
1051
} ,
1052
+ {
1053
+ id : 2 ,
1054
+ isStateEditable : false ,
1055
+ name : 'Memo' ,
1056
+ value : 'not used' ,
1057
+ subHooks : [ ] ,
1058
+ } ,
1035
1059
] ) ;
1036
1060
} ) ;
1037
1061
@@ -1043,6 +1067,7 @@ describe('ReactHooksInspectionIntegration', () => {
1043
1067
( ) => 'snapshot' ,
1044
1068
) ;
1045
1069
React . useMemo ( ( ) => 'memo' , [ ] ) ;
1070
+ React . useMemo ( ( ) => 'not used' , [ ] ) ;
1046
1071
return value ;
1047
1072
}
1048
1073
@@ -1064,6 +1089,13 @@ describe('ReactHooksInspectionIntegration', () => {
1064
1089
value : 'memo' ,
1065
1090
subHooks : [ ] ,
1066
1091
} ,
1092
+ {
1093
+ id : 2 ,
1094
+ isStateEditable : false ,
1095
+ name : 'Memo' ,
1096
+ value : 'not used' ,
1097
+ subHooks : [ ] ,
1098
+ } ,
1067
1099
] ) ;
1068
1100
} ) ;
1069
1101
} ) ;
0 commit comments