Skip to content

Commit 9e0cbef

Browse files
committed
s/form state/action state (#28631)
Rename internals from "form state" to "action state" DiffTrain build for commit 05797cc.
1 parent d9c978d commit 9e0cbef

File tree

10 files changed

+337
-301
lines changed

10 files changed

+337
-301
lines changed

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js

Lines changed: 44 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<9163dccf70951cc5d1bae88f3bef99d1>>
10+
* @generated SignedSource<<e3c2cd0dc2c519bacd879ada7f0bbba4>>
1111
*/
1212

1313
"use strict";
@@ -9122,10 +9122,10 @@ if (__DEV__) {
91229122
hook.baseState = passthrough;
91239123
var dispatch = hook.queue.dispatch;
91249124
return [passthrough, dispatch];
9125-
} // useFormState actions run sequentially, because each action receives the
9125+
} // useActionState actions run sequentially, because each action receives the
91269126
// previous state as an argument. We store pending actions on a queue.
91279127

9128-
function dispatchFormState(
9128+
function dispatchActionState(
91299129
fiber,
91309130
actionQueue,
91319131
setPendingState,
@@ -9146,7 +9146,7 @@ if (__DEV__) {
91469146
next: null // circular
91479147
};
91489148
newLast.next = actionQueue.pending = newLast;
9149-
runFormStateAction(actionQueue, setPendingState, setState, payload);
9149+
runActionStateAction(actionQueue, setPendingState, setState, payload);
91509150
} else {
91519151
// There's already an action running. Add to the queue.
91529152
var first = last.next;
@@ -9158,7 +9158,7 @@ if (__DEV__) {
91589158
}
91599159
}
91609160

9161-
function runFormStateAction(
9161+
function runActionStateAction(
91629162
actionQueue,
91639163
setPendingState,
91649164
setState,
@@ -9195,14 +9195,14 @@ if (__DEV__) {
91959195
thenable.then(
91969196
function (nextState) {
91979197
actionQueue.state = nextState;
9198-
finishRunningFormStateAction(
9198+
finishRunningActionStateAction(
91999199
actionQueue,
92009200
setPendingState,
92019201
setState
92029202
);
92039203
},
92049204
function () {
9205-
return finishRunningFormStateAction(
9205+
return finishRunningActionStateAction(
92069206
actionQueue,
92079207
setPendingState,
92089208
setState
@@ -9214,10 +9214,14 @@ if (__DEV__) {
92149214
setState(returnValue);
92159215
var nextState = returnValue;
92169216
actionQueue.state = nextState;
9217-
finishRunningFormStateAction(actionQueue, setPendingState, setState);
9217+
finishRunningActionStateAction(
9218+
actionQueue,
9219+
setPendingState,
9220+
setState
9221+
);
92189222
}
92199223
} catch (error) {
9220-
// This is a trick to get the `useFormState` hook to rethrow the error.
9224+
// This is a trick to get the `useActionState` hook to rethrow the error.
92219225
// When it unwraps the thenable with the `use` algorithm, the error
92229226
// will be thrown.
92239227
var rejectedThenable = {
@@ -9226,7 +9230,7 @@ if (__DEV__) {
92269230
reason: error // $FlowFixMe: Not sure why this doesn't work
92279231
};
92289232
setState(rejectedThenable);
9229-
finishRunningFormStateAction(actionQueue, setPendingState, setState);
9233+
finishRunningActionStateAction(actionQueue, setPendingState, setState);
92309234
} finally {
92319235
ReactCurrentBatchConfig$2.transition = prevTransition;
92329236

@@ -9248,7 +9252,7 @@ if (__DEV__) {
92489252
}
92499253
}
92509254

9251-
function finishRunningFormStateAction(
9255+
function finishRunningActionStateAction(
92529256
actionQueue,
92539257
setPendingState,
92549258
setState
@@ -9268,7 +9272,7 @@ if (__DEV__) {
92689272
var next = first.next;
92699273
last.next = next; // Run the next action.
92709274

9271-
runFormStateAction(
9275+
runActionStateAction(
92729276
actionQueue,
92739277
setPendingState,
92749278
setState,
@@ -9278,11 +9282,11 @@ if (__DEV__) {
92789282
}
92799283
}
92809284

9281-
function formStateReducer(oldState, newState) {
9285+
function actionStateReducer(oldState, newState) {
92829286
return newState;
92839287
}
92849288

9285-
function mountFormState(action, initialStateProp, permalink) {
9289+
function mountActionState(action, initialStateProp, permalink) {
92869290
var initialState = initialStateProp;
92879291
// the `use` algorithm during render.
92889292

@@ -9294,7 +9298,7 @@ if (__DEV__) {
92949298
pending: null,
92959299
lanes: NoLanes,
92969300
dispatch: null,
9297-
lastRenderedReducer: formStateReducer,
9301+
lastRenderedReducer: actionStateReducer,
92989302
lastRenderedState: initialState
92999303
};
93009304
stateHook.queue = stateQueue;
@@ -9326,7 +9330,7 @@ if (__DEV__) {
93269330
pending: null
93279331
};
93289332
actionQueueHook.queue = actionQueue;
9329-
var dispatch = dispatchFormState.bind(
9333+
var dispatch = dispatchActionState.bind(
93309334
null,
93319335
currentlyRenderingFiber$1,
93329336
actionQueue,
@@ -9341,13 +9345,13 @@ if (__DEV__) {
93419345
return [initialState, dispatch, false];
93429346
}
93439347

9344-
function updateFormState(action, initialState, permalink) {
9348+
function updateActionState(action, initialState, permalink) {
93459349
var stateHook = updateWorkInProgressHook();
93469350
var currentStateHook = currentHook;
9347-
return updateFormStateImpl(stateHook, currentStateHook, action);
9351+
return updateActionStateImpl(stateHook, currentStateHook, action);
93489352
}
93499353

9350-
function updateFormStateImpl(
9354+
function updateActionStateImpl(
93519355
stateHook,
93529356
currentStateHook,
93539357
action,
@@ -9357,7 +9361,7 @@ if (__DEV__) {
93579361
var _updateReducerImpl = updateReducerImpl(
93589362
stateHook,
93599363
currentStateHook,
9360-
formStateReducer
9364+
actionStateReducer
93619365
),
93629366
actionResult = _updateReducerImpl[0];
93639367

@@ -9380,7 +9384,7 @@ if (__DEV__) {
93809384
currentlyRenderingFiber$1.flags |= Passive$1;
93819385
pushEffect(
93829386
HasEffect | Passive,
9383-
formStateActionEffect.bind(null, actionQueue, action),
9387+
actionStateActionEffect.bind(null, actionQueue, action),
93849388
createEffectInstance(),
93859389
null
93869390
);
@@ -9389,12 +9393,12 @@ if (__DEV__) {
93899393
return [state, dispatch, isPending];
93909394
}
93919395

9392-
function formStateActionEffect(actionQueue, action) {
9396+
function actionStateActionEffect(actionQueue, action) {
93939397
actionQueue.action = action;
93949398
}
93959399

9396-
function rerenderFormState(action, initialState, permalink) {
9397-
// Unlike useState, useFormState doesn't support render phase updates.
9400+
function rerenderActionState(action, initialState, permalink) {
9401+
// Unlike useState, useActionState doesn't support render phase updates.
93989402
// Also unlike useState, we need to replay all pending updates again in case
93999403
// the passthrough value changed.
94009404
//
@@ -9406,7 +9410,7 @@ if (__DEV__) {
94069410

94079411
if (currentStateHook !== null) {
94089412
// This is an update. Process the update queue.
9409-
return updateFormStateImpl(stateHook, currentStateHook, action);
9413+
return updateActionStateImpl(stateHook, currentStateHook, action);
94109414
}
94119415

94129416
updateWorkInProgressHook(); // State
@@ -10466,7 +10470,7 @@ if (__DEV__) {
1046610470
) {
1046710471
currentHookNameInDev = "useFormState";
1046810472
mountHookTypesDev();
10469-
return mountFormState(action, initialState);
10473+
return mountActionState(action, initialState);
1047010474
};
1047110475

1047210476
HooksDispatcherOnMountInDEV.useActionState = function useActionState(
@@ -10476,7 +10480,7 @@ if (__DEV__) {
1047610480
) {
1047710481
currentHookNameInDev = "useActionState";
1047810482
mountHookTypesDev();
10479-
return mountFormState(action, initialState);
10483+
return mountActionState(action, initialState);
1048010484
};
1048110485
}
1048210486

@@ -10622,14 +10626,14 @@ if (__DEV__) {
1062210626
function useFormState(action, initialState, permalink) {
1062310627
currentHookNameInDev = "useFormState";
1062410628
updateHookTypesDev();
10625-
return mountFormState(action, initialState);
10629+
return mountActionState(action, initialState);
1062610630
};
1062710631

1062810632
HooksDispatcherOnMountWithHookTypesInDEV.useActionState =
1062910633
function useActionState(action, initialState, permalink) {
1063010634
currentHookNameInDev = "useActionState";
1063110635
updateHookTypesDev();
10632-
return mountFormState(action, initialState);
10636+
return mountActionState(action, initialState);
1063310637
};
1063410638
}
1063510639

@@ -10776,7 +10780,7 @@ if (__DEV__) {
1077610780
) {
1077710781
currentHookNameInDev = "useFormState";
1077810782
updateHookTypesDev();
10779-
return updateFormState(action);
10783+
return updateActionState(action);
1078010784
};
1078110785

1078210786
HooksDispatcherOnUpdateInDEV.useActionState = function useActionState(
@@ -10786,7 +10790,7 @@ if (__DEV__) {
1078610790
) {
1078710791
currentHookNameInDev = "useActionState";
1078810792
updateHookTypesDev();
10789-
return updateFormState(action);
10793+
return updateActionState(action);
1079010794
};
1079110795
}
1079210796

@@ -10935,7 +10939,7 @@ if (__DEV__) {
1093510939
) {
1093610940
currentHookNameInDev = "useFormState";
1093710941
updateHookTypesDev();
10938-
return rerenderFormState(action);
10942+
return rerenderActionState(action);
1093910943
};
1094010944

1094110945
HooksDispatcherOnRerenderInDEV.useActionState = function useActionState(
@@ -10945,7 +10949,7 @@ if (__DEV__) {
1094510949
) {
1094610950
currentHookNameInDev = "useActionState";
1094710951
updateHookTypesDev();
10948-
return rerenderFormState(action);
10952+
return rerenderActionState(action);
1094910953
};
1095010954
}
1095110955

@@ -11116,15 +11120,15 @@ if (__DEV__) {
1111611120
currentHookNameInDev = "useFormState";
1111711121
warnInvalidHookAccess();
1111811122
mountHookTypesDev();
11119-
return mountFormState(action, initialState);
11123+
return mountActionState(action, initialState);
1112011124
};
1112111125

1112211126
InvalidNestedHooksDispatcherOnMountInDEV.useActionState =
1112311127
function useActionState(action, initialState, permalink) {
1112411128
currentHookNameInDev = "useActionState";
1112511129
warnInvalidHookAccess();
1112611130
mountHookTypesDev();
11127-
return mountFormState(action, initialState);
11131+
return mountActionState(action, initialState);
1112811132
};
1112911133
}
1113011134

@@ -11294,15 +11298,15 @@ if (__DEV__) {
1129411298
currentHookNameInDev = "useFormState";
1129511299
warnInvalidHookAccess();
1129611300
updateHookTypesDev();
11297-
return updateFormState(action);
11301+
return updateActionState(action);
1129811302
};
1129911303

1130011304
InvalidNestedHooksDispatcherOnUpdateInDEV.useActionState =
1130111305
function useActionState(action, initialState, permalink) {
1130211306
currentHookNameInDev = "useActionState";
1130311307
warnInvalidHookAccess();
1130411308
updateHookTypesDev();
11305-
return updateFormState(action);
11309+
return updateActionState(action);
1130611310
};
1130711311
}
1130811312

@@ -11472,15 +11476,15 @@ if (__DEV__) {
1147211476
currentHookNameInDev = "useFormState";
1147311477
warnInvalidHookAccess();
1147411478
updateHookTypesDev();
11475-
return rerenderFormState(action);
11479+
return rerenderActionState(action);
1147611480
};
1147711481

1147811482
InvalidNestedHooksDispatcherOnRerenderInDEV.useActionState =
1147911483
function useActionState(action, initialState, permalink) {
1148011484
currentHookNameInDev = "useActionState";
1148111485
warnInvalidHookAccess();
1148211486
updateHookTypesDev();
11483-
return rerenderFormState(action);
11487+
return rerenderActionState(action);
1148411488
};
1148511489
}
1148611490

@@ -26246,7 +26250,7 @@ if (__DEV__) {
2624626250
return root;
2624726251
}
2624826252

26249-
var ReactVersion = "19.0.0-canary-9cf58c47";
26253+
var ReactVersion = "19.0.0-canary-04ac921d";
2625026254

2625126255
// Might add PROFILE later.
2625226256

0 commit comments

Comments
 (0)