@@ -18963,9 +18963,18 @@ function isRefOrRefLikeMutableType(type) {
1896318963function isSetStateType(id) {
1896418964 return id.type.kind === 'Function' && id.type.shapeId === 'BuiltInSetState';
1896518965}
18966+ function isUseActionStateType(id) {
18967+ return (id.type.kind === 'Object' && id.type.shapeId === 'BuiltInUseActionState');
18968+ }
1896618969function isStartTransitionType(id) {
1896718970 return (id.type.kind === 'Function' && id.type.shapeId === 'BuiltInStartTransition');
1896818971}
18972+ function isUseOptimisticType(id) {
18973+ return (id.type.kind === 'Object' && id.type.shapeId === 'BuiltInUseOptimistic');
18974+ }
18975+ function isSetOptimisticType(id) {
18976+ return (id.type.kind === 'Function' && id.type.shapeId === 'BuiltInSetOptimistic');
18977+ }
1896918978function isSetActionStateType(id) {
1897018979 return (id.type.kind === 'Function' && id.type.shapeId === 'BuiltInSetActionState');
1897118980}
@@ -18987,16 +18996,18 @@ function isStableType(id) {
1898718996 isSetActionStateType(id) ||
1898818997 isDispatcherType(id) ||
1898918998 isUseRefType(id) ||
18990- isStartTransitionType(id));
18999+ isStartTransitionType(id) ||
19000+ isSetOptimisticType(id));
1899119001}
1899219002function isStableTypeContainer(id) {
1899319003 const type_ = id.type;
1899419004 if (type_.kind !== 'Object') {
1899519005 return false;
1899619006 }
1899719007 return (isUseStateType(id) ||
18998- type_.shapeId === 'BuiltInUseActionState' ||
19008+ isUseActionStateType(id) ||
1899919009 isUseReducerType(id) ||
19010+ isUseOptimisticType(id) ||
1900019011 type_.shapeId === 'BuiltInUseTransition');
1900119012}
1900219013function evaluatesToStableTypeOrContainer(env, { value }) {
@@ -19009,6 +19020,7 @@ function evaluatesToStableTypeOrContainer(env, { value }) {
1900919020 case 'useActionState':
1901019021 case 'useRef':
1901119022 case 'useTransition':
19023+ case 'useOptimistic':
1901219024 return true;
1901319025 }
1901419026 }
@@ -22110,6 +22122,8 @@ const BuiltInUseReducerId = 'BuiltInUseReducer';
2211022122const BuiltInDispatchId = 'BuiltInDispatch';
2211122123const BuiltInUseContextHookId = 'BuiltInUseContextHook';
2211222124const BuiltInUseTransitionId = 'BuiltInUseTransition';
22125+ const BuiltInUseOptimisticId = 'BuiltInUseOptimistic';
22126+ const BuiltInSetOptimisticId = 'BuiltInSetOptimistic';
2211322127const BuiltInStartTransitionId = 'BuiltInStartTransition';
2211422128const BuiltInFireId = 'BuiltInFire';
2211522129const BuiltInFireFunctionId = 'BuiltInFireFunction';
@@ -22724,6 +22738,19 @@ addObject(BUILTIN_SHAPES, BuiltInUseTransitionId, [
2272422738 }, BuiltInStartTransitionId),
2272522739 ],
2272622740]);
22741+ addObject(BUILTIN_SHAPES, BuiltInUseOptimisticId, [
22742+ ['0', { kind: 'Poly' }],
22743+ [
22744+ '1',
22745+ addFunction(BUILTIN_SHAPES, [], {
22746+ positionalParams: [],
22747+ restParam: Effect.Freeze,
22748+ returnType: PRIMITIVE_TYPE,
22749+ calleeEffect: Effect.Read,
22750+ returnValueKind: ValueKind.Primitive,
22751+ }, BuiltInSetOptimisticId),
22752+ ],
22753+ ]);
2272722754addObject(BUILTIN_SHAPES, BuiltInUseActionStateId, [
2272822755 ['0', { kind: 'Poly' }],
2272922756 [
@@ -31167,6 +31194,18 @@ const REACT_APIS = [
3116731194 returnValueKind: ValueKind.Frozen,
3116831195 }),
3116931196 ],
31197+ [
31198+ 'useOptimistic',
31199+ addHook(DEFAULT_SHAPES, {
31200+ positionalParams: [],
31201+ restParam: Effect.Freeze,
31202+ returnType: { kind: 'Object', shapeId: BuiltInUseOptimisticId },
31203+ calleeEffect: Effect.Read,
31204+ hookKind: 'useOptimistic',
31205+ returnValueKind: ValueKind.Frozen,
31206+ returnValueReason: ValueReason.State,
31207+ }),
31208+ ],
3117031209 [
3117131210 'use',
3117231211 addFunction(DEFAULT_SHAPES, [], {
0 commit comments