Skip to content

Commit 66062f0

Browse files
committed
s/form state/action state (#28631)
Rename internals from "form state" to "action state" DiffTrain build for [05797cc](05797cc)
1 parent 2d8f86f commit 66062f0

23 files changed

+854
-790
lines changed

compiled/facebook-www/REVISION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
299a9c0598576f7dba170771b1c0b821281b1e15
1+
05797ccebd285999343ab4fb94eb542f84be23b1

compiled/facebook-www/ReactART-dev.classic.js

Lines changed: 43 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ if (__DEV__) {
6666
return self;
6767
}
6868

69-
var ReactVersion = "19.0.0-www-classic-407418be";
69+
var ReactVersion = "19.0.0-www-classic-3513bb8c";
7070

7171
var LegacyRoot = 0;
7272
var ConcurrentRoot = 1;
@@ -10518,10 +10518,10 @@ if (__DEV__) {
1051810518
hook.baseState = passthrough;
1051910519
var dispatch = hook.queue.dispatch;
1052010520
return [passthrough, dispatch];
10521-
} // useFormState actions run sequentially, because each action receives the
10521+
} // useActionState actions run sequentially, because each action receives the
1052210522
// previous state as an argument. We store pending actions on a queue.
1052310523

10524-
function dispatchFormState(
10524+
function dispatchActionState(
1052510525
fiber,
1052610526
actionQueue,
1052710527
setPendingState,
@@ -10542,7 +10542,7 @@ if (__DEV__) {
1054210542
next: null // circular
1054310543
};
1054410544
newLast.next = actionQueue.pending = newLast;
10545-
runFormStateAction(actionQueue, setPendingState, setState, payload);
10545+
runActionStateAction(actionQueue, setPendingState, setState, payload);
1054610546
} else {
1054710547
// There's already an action running. Add to the queue.
1054810548
var first = last.next;
@@ -10554,7 +10554,7 @@ if (__DEV__) {
1055410554
}
1055510555
}
1055610556

10557-
function runFormStateAction(
10557+
function runActionStateAction(
1055810558
actionQueue,
1055910559
setPendingState,
1056010560
setState,
@@ -10591,14 +10591,14 @@ if (__DEV__) {
1059110591
thenable.then(
1059210592
function (nextState) {
1059310593
actionQueue.state = nextState;
10594-
finishRunningFormStateAction(
10594+
finishRunningActionStateAction(
1059510595
actionQueue,
1059610596
setPendingState,
1059710597
setState
1059810598
);
1059910599
},
1060010600
function () {
10601-
return finishRunningFormStateAction(
10601+
return finishRunningActionStateAction(
1060210602
actionQueue,
1060310603
setPendingState,
1060410604
setState
@@ -10610,10 +10610,14 @@ if (__DEV__) {
1061010610
setState(returnValue);
1061110611
var nextState = returnValue;
1061210612
actionQueue.state = nextState;
10613-
finishRunningFormStateAction(actionQueue, setPendingState, setState);
10613+
finishRunningActionStateAction(
10614+
actionQueue,
10615+
setPendingState,
10616+
setState
10617+
);
1061410618
}
1061510619
} catch (error) {
10616-
// This is a trick to get the `useFormState` hook to rethrow the error.
10620+
// This is a trick to get the `useActionState` hook to rethrow the error.
1061710621
// When it unwraps the thenable with the `use` algorithm, the error
1061810622
// will be thrown.
1061910623
var rejectedThenable = {
@@ -10622,7 +10626,7 @@ if (__DEV__) {
1062210626
reason: error // $FlowFixMe: Not sure why this doesn't work
1062310627
};
1062410628
setState(rejectedThenable);
10625-
finishRunningFormStateAction(actionQueue, setPendingState, setState);
10629+
finishRunningActionStateAction(actionQueue, setPendingState, setState);
1062610630
} finally {
1062710631
ReactCurrentBatchConfig$2.transition = prevTransition;
1062810632

@@ -10644,7 +10648,7 @@ if (__DEV__) {
1064410648
}
1064510649
}
1064610650

10647-
function finishRunningFormStateAction(
10651+
function finishRunningActionStateAction(
1064810652
actionQueue,
1064910653
setPendingState,
1065010654
setState
@@ -10664,7 +10668,7 @@ if (__DEV__) {
1066410668
var next = first.next;
1066510669
last.next = next; // Run the next action.
1066610670

10667-
runFormStateAction(
10671+
runActionStateAction(
1066810672
actionQueue,
1066910673
setPendingState,
1067010674
setState,
@@ -10674,11 +10678,11 @@ if (__DEV__) {
1067410678
}
1067510679
}
1067610680

10677-
function formStateReducer(oldState, newState) {
10681+
function actionStateReducer(oldState, newState) {
1067810682
return newState;
1067910683
}
1068010684

10681-
function mountFormState(action, initialStateProp, permalink) {
10685+
function mountActionState(action, initialStateProp, permalink) {
1068210686
var initialState = initialStateProp;
1068310687
// the `use` algorithm during render.
1068410688

@@ -10690,7 +10694,7 @@ if (__DEV__) {
1069010694
pending: null,
1069110695
lanes: NoLanes,
1069210696
dispatch: null,
10693-
lastRenderedReducer: formStateReducer,
10697+
lastRenderedReducer: actionStateReducer,
1069410698
lastRenderedState: initialState
1069510699
};
1069610700
stateHook.queue = stateQueue;
@@ -10722,7 +10726,7 @@ if (__DEV__) {
1072210726
pending: null
1072310727
};
1072410728
actionQueueHook.queue = actionQueue;
10725-
var dispatch = dispatchFormState.bind(
10729+
var dispatch = dispatchActionState.bind(
1072610730
null,
1072710731
currentlyRenderingFiber$1,
1072810732
actionQueue,
@@ -10737,13 +10741,13 @@ if (__DEV__) {
1073710741
return [initialState, dispatch, false];
1073810742
}
1073910743

10740-
function updateFormState(action, initialState, permalink) {
10744+
function updateActionState(action, initialState, permalink) {
1074110745
var stateHook = updateWorkInProgressHook();
1074210746
var currentStateHook = currentHook;
10743-
return updateFormStateImpl(stateHook, currentStateHook, action);
10747+
return updateActionStateImpl(stateHook, currentStateHook, action);
1074410748
}
1074510749

10746-
function updateFormStateImpl(
10750+
function updateActionStateImpl(
1074710751
stateHook,
1074810752
currentStateHook,
1074910753
action,
@@ -10753,7 +10757,7 @@ if (__DEV__) {
1075310757
var _updateReducerImpl = updateReducerImpl(
1075410758
stateHook,
1075510759
currentStateHook,
10756-
formStateReducer
10760+
actionStateReducer
1075710761
),
1075810762
actionResult = _updateReducerImpl[0];
1075910763

@@ -10776,7 +10780,7 @@ if (__DEV__) {
1077610780
currentlyRenderingFiber$1.flags |= Passive$1;
1077710781
pushEffect(
1077810782
HasEffect | Passive,
10779-
formStateActionEffect.bind(null, actionQueue, action),
10783+
actionStateActionEffect.bind(null, actionQueue, action),
1078010784
createEffectInstance(),
1078110785
null
1078210786
);
@@ -10785,12 +10789,12 @@ if (__DEV__) {
1078510789
return [state, dispatch, isPending];
1078610790
}
1078710791

10788-
function formStateActionEffect(actionQueue, action) {
10792+
function actionStateActionEffect(actionQueue, action) {
1078910793
actionQueue.action = action;
1079010794
}
1079110795

10792-
function rerenderFormState(action, initialState, permalink) {
10793-
// Unlike useState, useFormState doesn't support render phase updates.
10796+
function rerenderActionState(action, initialState, permalink) {
10797+
// Unlike useState, useActionState doesn't support render phase updates.
1079410798
// Also unlike useState, we need to replay all pending updates again in case
1079510799
// the passthrough value changed.
1079610800
//
@@ -10802,7 +10806,7 @@ if (__DEV__) {
1080210806

1080310807
if (currentStateHook !== null) {
1080410808
// This is an update. Process the update queue.
10805-
return updateFormStateImpl(stateHook, currentStateHook, action);
10809+
return updateActionStateImpl(stateHook, currentStateHook, action);
1080610810
}
1080710811

1080810812
updateWorkInProgressHook(); // State
@@ -12055,7 +12059,7 @@ if (__DEV__) {
1205512059
) {
1205612060
currentHookNameInDev = "useFormState";
1205712061
mountHookTypesDev();
12058-
return mountFormState(action, initialState);
12062+
return mountActionState(action, initialState);
1205912063
};
1206012064

1206112065
HooksDispatcherOnMountInDEV.useActionState = function useActionState(
@@ -12065,7 +12069,7 @@ if (__DEV__) {
1206512069
) {
1206612070
currentHookNameInDev = "useActionState";
1206712071
mountHookTypesDev();
12068-
return mountFormState(action, initialState);
12072+
return mountActionState(action, initialState);
1206912073
};
1207012074
}
1207112075

@@ -12220,14 +12224,14 @@ if (__DEV__) {
1222012224
function useFormState(action, initialState, permalink) {
1222112225
currentHookNameInDev = "useFormState";
1222212226
updateHookTypesDev();
12223-
return mountFormState(action, initialState);
12227+
return mountActionState(action, initialState);
1222412228
};
1222512229

1222612230
HooksDispatcherOnMountWithHookTypesInDEV.useActionState =
1222712231
function useActionState(action, initialState, permalink) {
1222812232
currentHookNameInDev = "useActionState";
1222912233
updateHookTypesDev();
12230-
return mountFormState(action, initialState);
12234+
return mountActionState(action, initialState);
1223112235
};
1223212236
}
1223312237

@@ -12384,7 +12388,7 @@ if (__DEV__) {
1238412388
) {
1238512389
currentHookNameInDev = "useFormState";
1238612390
updateHookTypesDev();
12387-
return updateFormState(action);
12391+
return updateActionState(action);
1238812392
};
1238912393

1239012394
HooksDispatcherOnUpdateInDEV.useActionState = function useActionState(
@@ -12394,7 +12398,7 @@ if (__DEV__) {
1239412398
) {
1239512399
currentHookNameInDev = "useActionState";
1239612400
updateHookTypesDev();
12397-
return updateFormState(action);
12401+
return updateActionState(action);
1239812402
};
1239912403
}
1240012404

@@ -12553,7 +12557,7 @@ if (__DEV__) {
1255312557
) {
1255412558
currentHookNameInDev = "useFormState";
1255512559
updateHookTypesDev();
12556-
return rerenderFormState(action);
12560+
return rerenderActionState(action);
1255712561
};
1255812562

1255912563
HooksDispatcherOnRerenderInDEV.useActionState = function useActionState(
@@ -12563,7 +12567,7 @@ if (__DEV__) {
1256312567
) {
1256412568
currentHookNameInDev = "useActionState";
1256512569
updateHookTypesDev();
12566-
return rerenderFormState(action);
12570+
return rerenderActionState(action);
1256712571
};
1256812572
}
1256912573

@@ -12744,15 +12748,15 @@ if (__DEV__) {
1274412748
currentHookNameInDev = "useFormState";
1274512749
warnInvalidHookAccess();
1274612750
mountHookTypesDev();
12747-
return mountFormState(action, initialState);
12751+
return mountActionState(action, initialState);
1274812752
};
1274912753

1275012754
InvalidNestedHooksDispatcherOnMountInDEV.useActionState =
1275112755
function useActionState(action, initialState, permalink) {
1275212756
currentHookNameInDev = "useActionState";
1275312757
warnInvalidHookAccess();
1275412758
mountHookTypesDev();
12755-
return mountFormState(action, initialState);
12759+
return mountActionState(action, initialState);
1275612760
};
1275712761
}
1275812762

@@ -12932,15 +12936,15 @@ if (__DEV__) {
1293212936
currentHookNameInDev = "useFormState";
1293312937
warnInvalidHookAccess();
1293412938
updateHookTypesDev();
12935-
return updateFormState(action);
12939+
return updateActionState(action);
1293612940
};
1293712941

1293812942
InvalidNestedHooksDispatcherOnUpdateInDEV.useActionState =
1293912943
function useActionState(action, initialState, permalink) {
1294012944
currentHookNameInDev = "useActionState";
1294112945
warnInvalidHookAccess();
1294212946
updateHookTypesDev();
12943-
return updateFormState(action);
12947+
return updateActionState(action);
1294412948
};
1294512949
}
1294612950

@@ -13120,15 +13124,15 @@ if (__DEV__) {
1312013124
currentHookNameInDev = "useFormState";
1312113125
warnInvalidHookAccess();
1312213126
updateHookTypesDev();
13123-
return rerenderFormState(action);
13127+
return rerenderActionState(action);
1312413128
};
1312513129

1312613130
InvalidNestedHooksDispatcherOnRerenderInDEV.useActionState =
1312713131
function useActionState(action, initialState, permalink) {
1312813132
currentHookNameInDev = "useActionState";
1312913133
warnInvalidHookAccess();
1313013134
updateHookTypesDev();
13131-
return rerenderFormState(action);
13135+
return rerenderActionState(action);
1313213136
};
1313313137
}
1313413138

0 commit comments

Comments
 (0)