Skip to content

Commit

Permalink
Reconciler: Change commitUpdate signature to account for unused `up…
Browse files Browse the repository at this point in the history
…datePayload` parameter
  • Loading branch information
eps1lon committed Apr 25, 2024
1 parent cf5ab8b commit 3db92a6
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 50 deletions.
8 changes: 1 addition & 7 deletions packages/react-art/src/ReactFiberConfigART.js
Original file line number Diff line number Diff line change
Expand Up @@ -415,13 +415,7 @@ export function commitMount(instance, type, newProps) {
// Noop
}

export function commitUpdate(
instance,
updatePayload,
type,
oldProps,
newProps,
) {
export function commitUpdate(instance, type, oldProps, newProps) {
instance._applyProps(instance, newProps, oldProps);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,6 @@ export function commitMount(

export function commitUpdate(
domElement: Instance,
updatePayload: any,
type: string,
oldProps: Props,
newProps: Props,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,6 @@ export function commitMount(

export function commitUpdate(
instance: Instance,
updatePayloadTODO: Object,
type: string,
oldProps: Props,
newProps: Props,
Expand Down
1 change: 0 additions & 1 deletion packages/react-noop-renderer/src/createReactNoop.js
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,6 @@ function createReactNoop(reconciler: Function, useMutation: boolean) {

commitUpdate(
instance: Instance,
updatePayload: Object,
type: string,
oldProps: Props,
newProps: Props,
Expand Down
51 changes: 12 additions & 39 deletions packages/react-reconciler/src/ReactFiberCommitWork.js
Original file line number Diff line number Diff line change
Expand Up @@ -506,8 +506,7 @@ function commitBeforeMutationEffectsOnFiber(finishedWork: Fiber) {
prevState,
);
if (__DEV__) {
const didWarnSet =
((didWarnAboutUndefinedSnapshotBeforeUpdate: any): Set<mixed>);
const didWarnSet = ((didWarnAboutUndefinedSnapshotBeforeUpdate: any): Set<mixed>);
if (snapshot === undefined && !didWarnSet.has(finishedWork.type)) {
didWarnSet.add(finishedWork.type);
console.error(
Expand Down Expand Up @@ -572,8 +571,7 @@ function commitHookEffectListUnmount(
finishedWork: Fiber,
nearestMountedAncestor: Fiber | null,
) {
const updateQueue: FunctionComponentUpdateQueue | null =
(finishedWork.updateQueue: any);
const updateQueue: FunctionComponentUpdateQueue | null = (finishedWork.updateQueue: any);
const lastEffect = updateQueue !== null ? updateQueue.lastEffect : null;
if (lastEffect !== null) {
const firstEffect = lastEffect.next;
Expand Down Expand Up @@ -620,8 +618,7 @@ function commitHookEffectListUnmount(
}

function commitHookEffectListMount(flags: HookFlags, finishedWork: Fiber) {
const updateQueue: FunctionComponentUpdateQueue | null =
(finishedWork.updateQueue: any);
const updateQueue: FunctionComponentUpdateQueue | null = (finishedWork.updateQueue: any);
const lastEffect = updateQueue !== null ? updateQueue.lastEffect : null;
if (lastEffect !== null) {
const firstEffect = lastEffect.next;
Expand Down Expand Up @@ -710,8 +707,7 @@ function commitHookEffectListMount(flags: HookFlags, finishedWork: Fiber) {
}

function commitUseEffectEventMount(finishedWork: Fiber) {
const updateQueue: FunctionComponentUpdateQueue | null =
(finishedWork.updateQueue: any);
const updateQueue: FunctionComponentUpdateQueue | null = (finishedWork.updateQueue: any);
const eventPayloads = updateQueue !== null ? updateQueue.events : null;
if (eventPayloads !== null) {
for (let ii = 0; ii < eventPayloads.length; ii++) {
Expand Down Expand Up @@ -918,8 +914,7 @@ function commitClassLayoutLifecycles(
function commitClassCallbacks(finishedWork: Fiber) {
// TODO: I think this is now always non-null by the time it reaches the
// commit phase. Consider removing the type check.
const updateQueue: UpdateQueue<mixed> | null =
(finishedWork.updateQueue: any);
const updateQueue: UpdateQueue<mixed> | null = (finishedWork.updateQueue: any);
if (updateQueue !== null) {
const instance = finishedWork.stateNode;
if (__DEV__) {
Expand Down Expand Up @@ -1087,8 +1082,7 @@ function commitLayoutEffectOnFiber(
if (flags & Callback) {
// TODO: I think this is now always non-null by the time it reaches the
// commit phase. Consider removing the type check.
const updateQueue: UpdateQueue<mixed> | null =
(finishedWork.updateQueue: any);
const updateQueue: UpdateQueue<mixed> | null = (finishedWork.updateQueue: any);
if (updateQueue !== null) {
let instance = null;
if (finishedWork.child !== null) {
Expand Down Expand Up @@ -2171,8 +2165,7 @@ function commitDeletionEffectsOnFiber(
case MemoComponent:
case SimpleMemoComponent: {
if (!offscreenSubtreeWasHidden) {
const updateQueue: FunctionComponentUpdateQueue | null =
(deletedFiber.updateQueue: any);
const updateQueue: FunctionComponentUpdateQueue | null = (deletedFiber.updateQueue: any);
if (updateQueue !== null) {
const lastEffect = updateQueue.lastEffect;
if (lastEffect !== null) {
Expand Down Expand Up @@ -2601,8 +2594,7 @@ function commitMutationEffectsOnFiber(
}

if (flags & Callback && offscreenSubtreeIsHidden) {
const updateQueue: UpdateQueue<mixed> | null =
(finishedWork.updateQueue: any);
const updateQueue: UpdateQueue<mixed> | null = (finishedWork.updateQueue: any);
if (updateQueue !== null) {
deferHiddenCallbacks(updateQueue);
}
Expand Down Expand Up @@ -2676,14 +2668,9 @@ function commitMutationEffectsOnFiber(
);
}
} else if (newResource === null && finishedWork.stateNode !== null) {
// We may have an update on a Hoistable element
const updatePayload: null | UpdatePayload =
(finishedWork.updateQueue: any);
finishedWork.updateQueue = null;
try {
commitUpdate(
finishedWork.stateNode,
updatePayload,
finishedWork.type,
current.memoizedProps,
finishedWork.memoizedProps,
Expand Down Expand Up @@ -2754,19 +2741,8 @@ function commitMutationEffectsOnFiber(
const oldProps =
current !== null ? current.memoizedProps : newProps;
const type = finishedWork.type;
// TODO: Type the updateQueue to be specific to host components.
const updatePayload: null | UpdatePayload =
(finishedWork.updateQueue: any);
finishedWork.updateQueue = null;
try {
commitUpdate(
instance,
updatePayload,
type,
oldProps,
newProps,
finishedWork,
);
commitUpdate(instance, type, oldProps, newProps, finishedWork);
} catch (error) {
captureCommitPhaseError(finishedWork, finishedWork.return, error);
}
Expand Down Expand Up @@ -3040,8 +3016,7 @@ function commitMutationEffectsOnFiber(

// TODO: Move to passive phase
if (flags & Update) {
const offscreenQueue: OffscreenQueue | null =
(finishedWork.updateQueue: any);
const offscreenQueue: OffscreenQueue | null = (finishedWork.updateQueue: any);
if (offscreenQueue !== null) {
const retryQueue = offscreenQueue.retryQueue;
if (retryQueue !== null) {
Expand All @@ -3057,8 +3032,7 @@ function commitMutationEffectsOnFiber(
commitReconciliationEffects(finishedWork);

if (flags & Update) {
const retryQueue: Set<Wakeable> | null =
(finishedWork.updateQueue: any);
const retryQueue: Set<Wakeable> | null = (finishedWork.updateQueue: any);
if (retryQueue !== null) {
finishedWork.updateQueue = null;
attachSuspenseRetryListeners(finishedWork, retryQueue);
Expand Down Expand Up @@ -3293,8 +3267,7 @@ export function reappearLayoutEffects(

// Commit any callbacks that would have fired while the component
// was hidden.
const updateQueue: UpdateQueue<mixed> | null =
(finishedWork.updateQueue: any);
const updateQueue: UpdateQueue<mixed> | null = (finishedWork.updateQueue: any);
if (updateQueue !== null) {
commitHiddenCallbacks(updateQueue, instance);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,6 @@ export const supportsMutation = true;

export function commitUpdate(
instance: Instance,
updatePayload: null | {...},
type: string,
oldProps: Props,
newProps: Props,
Expand Down

0 comments on commit 3db92a6

Please sign in to comment.