Skip to content

Commit c6f3f7a

Browse files
committed
Update name to useFormStatus
1 parent 62badab commit c6f3f7a

File tree

6 files changed

+6
-141
lines changed

6 files changed

+6
-141
lines changed

compiler/packages/babel-plugin-react-compiler/src/HIR/Globals.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {
1111
BuiltInArrayId,
1212
BuiltInUseActionStateId,
1313
BuiltInUseEffectHookId,
14-
BuiltInUseFormStateId,
1514
BuiltInUseInsertionEffectHookId,
1615
BuiltInUseLayoutEffectHookId,
1716
BuiltInUseOperatorId,
@@ -280,18 +279,6 @@ const REACT_APIS: Array<[string, BuiltInType]> = [
280279
returnValueReason: ValueReason.State,
281280
}),
282281
],
283-
[
284-
"useFormState",
285-
addHook(DEFAULT_SHAPES, {
286-
positionalParams: [],
287-
restParam: Effect.Freeze,
288-
returnType: { kind: "Object", shapeId: BuiltInUseFormStateId },
289-
calleeEffect: Effect.Read,
290-
hookKind: "useFormState",
291-
returnValueKind: ValueKind.Frozen,
292-
returnValueReason: ValueReason.State,
293-
}),
294-
],
295282
[
296283
"useReducer",
297284
addHook(DEFAULT_SHAPES, {

compiler/packages/babel-plugin-react-compiler/src/HIR/HIR.ts

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1555,16 +1555,6 @@ export function isSetActionStateType(id: Identifier): boolean {
15551555
);
15561556
}
15571557

1558-
export function isUseFormStateType(id: Identifier): boolean {
1559-
return id.type.kind === "Object" && id.type.shapeId === "BuiltInUseFormState";
1560-
}
1561-
1562-
export function isSetFormStateType(id: Identifier): boolean {
1563-
return (
1564-
id.type.kind === "Function" && id.type.shapeId === "BuiltInSetFormState"
1565-
);
1566-
}
1567-
15681558
export function isUseReducerType(id: Identifier): boolean {
15691559
return id.type.kind === "Function" && id.type.shapeId === "BuiltInUseReducer";
15701560
}
@@ -1574,12 +1564,7 @@ export function isDispatcherType(id: Identifier): boolean {
15741564
}
15751565

15761566
export function isStableType(id: Identifier): boolean {
1577-
return (
1578-
isSetStateType(id) ||
1579-
isSetActionStateType(id) ||
1580-
isSetFormStateType(id) ||
1581-
isDispatcherType(id)
1582-
);
1567+
return isSetStateType(id) || isSetActionStateType(id) || isDispatcherType(id);
15831568
}
15841569

15851570
export function isUseEffectHookType(id: Identifier): boolean {

compiler/packages/babel-plugin-react-compiler/src/HIR/ObjectShape.ts

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ export type HookKind =
119119
| "useContext"
120120
| "useState"
121121
| "useActionState"
122-
| "useFormState"
123122
| "useReducer"
124123
| "useRef"
125124
| "useEffect"
@@ -199,8 +198,6 @@ export const BuiltInUseStateId = "BuiltInUseState";
199198
export const BuiltInSetStateId = "BuiltInSetState";
200199
export const BuiltInUseActionStateId = "BuiltInUseActionState";
201200
export const BuiltInSetActionStateId = "BuiltInSetActionState";
202-
export const BuiltInUseFormStateId = "BuiltInUseFormState";
203-
export const BuiltInSetFormStateId = "BuiltInSetFormState";
204201
export const BuiltInUseRefId = "BuiltInUseRefId";
205202
export const BuiltInRefValueId = "BuiltInRefValue";
206203
export const BuiltInMixedReadonlyId = "BuiltInMixedReadonly";
@@ -421,25 +418,6 @@ addObject(BUILTIN_SHAPES, BuiltInUseActionStateId, [
421418
],
422419
]);
423420

424-
addObject(BUILTIN_SHAPES, BuiltInUseFormStateId, [
425-
["0", { kind: "Poly" }],
426-
[
427-
"1",
428-
addFunction(
429-
BUILTIN_SHAPES,
430-
[],
431-
{
432-
positionalParams: [],
433-
restParam: Effect.Freeze,
434-
returnType: PRIMITIVE_TYPE,
435-
calleeEffect: Effect.Read,
436-
returnValueKind: ValueKind.Primitive,
437-
},
438-
BuiltInSetFormStateId
439-
),
440-
],
441-
]);
442-
443421
addObject(BUILTIN_SHAPES, BuiltInUseReducerId, [
444422
["0", { kind: "Poly" }],
445423
[

compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/useActionState-dispatch-considered-as-non-reactive.expect.md

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,26 +28,20 @@ import { c as _c } from "react/compiler-runtime";
2828
import { useActionState } from "react";
2929

3030
function Component() {
31-
const $ = _c(2);
31+
const $ = _c(1);
3232
const [actionState, dispatchAction] = useActionState();
3333
let t0;
3434
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
35-
t0 = () => {
35+
const onSubmitAction = () => {
3636
dispatchAction();
3737
};
38+
39+
t0 = <Foo onSubmitAction={onSubmitAction} />;
3840
$[0] = t0;
3941
} else {
4042
t0 = $[0];
4143
}
42-
const onSubmitAction = t0;
43-
let t1;
44-
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
45-
t1 = <Foo onSubmitAction={onSubmitAction} />;
46-
$[1] = t1;
47-
} else {
48-
t1 = $[1];
49-
}
50-
return t1;
44+
return t0;
5145
}
5246

5347
function Foo() {}

compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/useFormState-dispatch-considered-as-non-reactive.expect.md

Lines changed: 0 additions & 63 deletions
This file was deleted.

compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/useFormState-dispatch-considered-as-non-reactive.js

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)