Skip to content

Commit

Permalink
s/form state/action state
Browse files Browse the repository at this point in the history
  • Loading branch information
rickhanlonii committed Mar 25, 2024
1 parent 5a75f9e commit c4621aa
Show file tree
Hide file tree
Showing 11 changed files with 122 additions and 113 deletions.
2 changes: 2 additions & 0 deletions packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js
Original file line number Diff line number Diff line change
Expand Up @@ -1819,12 +1819,14 @@ function injectFormReplayingRuntime(
const formStateMarkerIsMatching = stringToPrecomputedChunk('<!--F!-->');
const formStateMarkerIsNotMatching = stringToPrecomputedChunk('<!--F-->');

// TODO: rename to pushActionState?
export function pushFormStateMarkerIsMatching(
target: Array<Chunk | PrecomputedChunk>,
) {
target.push(formStateMarkerIsMatching);
}

// TODO: rename to pushActionState?
export function pushFormStateMarkerIsNotMatching(
target: Array<Chunk | PrecomputedChunk>,
) {
Expand Down
4 changes: 2 additions & 2 deletions packages/react-dom/src/__tests__/ReactDOMFizzServer-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6208,8 +6208,8 @@ describe('ReactDOMFizzServer', () => {
// Because of the render phase update above, this component is evaluated
// multiple times (even during SSR), but it should only emit a single
// marker per useActionState instance.
const [formState] = useActionState(action, 0);
const text = `${readText('Child')}:${formState}:${localState}`;
const [actionState] = useActionState(action, 0);
const text = `${readText('Child')}:${actionState}:${localState}`;
return (
<div id="child" ref={childRef}>
{text}
Expand Down
2 changes: 1 addition & 1 deletion packages/react-dom/src/__tests__/ReactDOMForm-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1280,7 +1280,7 @@ describe('ReactDOMForm', () => {
});

// @gate enableAsyncActions
test('useFormState works in StrictMode', async () => {
test('useActionState works in StrictMode', async () => {
let actionCounter = 0;
async function action(state, type) {
actionCounter++;
Expand Down
Loading

0 comments on commit c4621aa

Please sign in to comment.