File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed
compiler/packages/babel-plugin-react-compiler/src
__tests__/fixtures/compiler/preserve-memo-validation Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -1889,7 +1889,7 @@ export function isStartTransitionType(id: Identifier): boolean {
18891889
18901890export function isUseOptimisticType ( id : Identifier ) : boolean {
18911891 return (
1892- id . type . kind === 'Function ' && id . type . shapeId === 'BuiltInUseOptimistic'
1892+ id . type . kind === 'Object ' && id . type . shapeId === 'BuiltInUseOptimistic'
18931893 ) ;
18941894}
18951895
@@ -1944,10 +1944,10 @@ export function isStableTypeContainer(id: Identifier): boolean {
19441944 }
19451945 return (
19461946 isUseStateType ( id ) || // setState
1947- type_ . shapeId === 'BuiltInUseActionState' || // setActionState
1947+ isUseActionStateType ( id ) || // setActionState
19481948 isUseReducerType ( id ) || // dispatcher
1949- type_ . shapeId === 'BuiltInUseTransition' || // startTransition
1950- isUseOptimisticType ( id ) // setOptimistic
1949+ isUseOptimisticType ( id ) || // setOptimistic
1950+ type_ . shapeId === 'BuiltInUseTransition' // startTransition
19511951 ) ;
19521952}
19531953
@@ -1966,6 +1966,7 @@ export function evaluatesToStableTypeOrContainer(
19661966 case 'useActionState' :
19671967 case 'useRef' :
19681968 case 'useTransition' :
1969+ case 'useOptimistic' :
19691970 return true ;
19701971 }
19711972 }
Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ function useFoo() {
6565 t0 = () => {
6666 dispatch ();
6767 startTransition (_temp3);
68- addOptimistic ()
68+ addOptimistic ();
6969 setState (null );
7070 dispatchAction ();
7171 ref .current = true ;
@@ -88,4 +88,4 @@ export const FIXTURE_ENTRYPOINT = {
8888```
8989
9090### Eval output
91- (kind: ok) "[[ function params=0 ]] "
91+ (kind: ok) "[[ function params=0 ]] "
You can’t perform that action at this time.
0 commit comments