Skip to content

Commit e246c05

Browse files
committed
Remove eventTime field from class Update type (#26219)
`eventTime` is a vestigial field that can be cleaned up. It was originally used as part of the starvation mechanism but it's since been replaced by a per-lane field on the root. This is a part of a series of smaller refactors I'm doing to simplify/speed up the `setState` path, related to the Sync Unification project that @tyao1 has been working on. DiffTrain build for commit c04b180.
1 parent b6024b9 commit e246c05

28 files changed

+494
-675
lines changed

compiled/facebook-www/REVISION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
212b89fa25fd0a39473e845d1665d45f9da9dad3
1+
c04b18070145b82111e1162729f4776f4d2c6112
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
212b89fa25fd0a39473e845d1665d45f9da9dad3
1+
c04b18070145b82111e1162729f4776f4d2c6112

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ if (
2727
}
2828
"use strict";
2929

30-
var ReactVersion = "18.3.0-www-classic-212b89fa2-20230221";
30+
var ReactVersion = "18.3.0-www-classic-c04b18070-20230222";
3131

3232
// ATTENTION
3333
// When adding new symbols to this file,

compiled/facebook-www/React-dev.modern.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ if (
2727
}
2828
"use strict";
2929

30-
var ReactVersion = "18.3.0-www-modern-212b89fa2-20230221";
30+
var ReactVersion = "18.3.0-www-modern-c04b18070-20230222";
3131

3232
// ATTENTION
3333
// When adding new symbols to this file,

compiled/facebook-www/React-prod.classic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -646,4 +646,4 @@ exports.useSyncExternalStore = function (
646646
);
647647
};
648648
exports.useTransition = useTransition;
649-
exports.version = "18.3.0-www-classic-212b89fa2-20230221";
649+
exports.version = "18.3.0-www-classic-c04b18070-20230222";

compiled/facebook-www/React-prod.modern.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,4 +638,4 @@ exports.useSyncExternalStore = function (
638638
);
639639
};
640640
exports.useTransition = useTransition;
641-
exports.version = "18.3.0-www-modern-212b89fa2-20230221";
641+
exports.version = "18.3.0-www-modern-c04b18070-20230222";

compiled/facebook-www/React-profiling.classic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,7 @@ exports.useSyncExternalStore = function (
657657
);
658658
};
659659
exports.useTransition = useTransition;
660-
exports.version = "18.3.0-www-classic-212b89fa2-20230221";
660+
exports.version = "18.3.0-www-classic-c04b18070-20230222";
661661

662662
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
663663
if (

compiled/facebook-www/React-profiling.modern.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ exports.useSyncExternalStore = function (
649649
);
650650
};
651651
exports.useTransition = useTransition;
652-
exports.version = "18.3.0-www-modern-212b89fa2-20230221";
652+
exports.version = "18.3.0-www-modern-c04b18070-20230222";
653653

654654
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
655655
if (

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

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function _assertThisInitialized(self) {
6969
return self;
7070
}
7171

72-
var ReactVersion = "18.3.0-www-classic-212b89fa2-20230221";
72+
var ReactVersion = "18.3.0-www-classic-c04b18070-20230222";
7373

7474
var LegacyRoot = 0;
7575
var ConcurrentRoot = 1;
@@ -4321,9 +4321,8 @@ function cloneUpdateQueue(current, workInProgress) {
43214321
workInProgress.updateQueue = clone;
43224322
}
43234323
}
4324-
function createUpdate(eventTime, lane) {
4324+
function createUpdate(lane) {
43254325
var update = {
4326-
eventTime: eventTime,
43274326
lane: lane,
43284327
tag: UpdateState,
43294328
payload: null,
@@ -4439,7 +4438,6 @@ function enqueueCapturedUpdate(workInProgress, capturedUpdate) {
44394438

44404439
do {
44414440
var clone = {
4442-
eventTime: update.eventTime,
44434441
lane: update.lane,
44444442
tag: update.tag,
44454443
payload: update.payload,
@@ -4652,11 +4650,9 @@ function processUpdateQueue(workInProgress, props, instance, renderLanes) {
46524650
var update = firstBaseUpdate;
46534651

46544652
do {
4655-
// TODO: Don't need this field anymore
4656-
var updateEventTime = update.eventTime; // An extra OffscreenLane bit is added to updates that were made to
4653+
// An extra OffscreenLane bit is added to updates that were made to
46574654
// a hidden tree, so that we can distinguish them from updates that were
46584655
// already there when the tree was hidden.
4659-
46604656
var updateLane = removeLanes(update.lane, OffscreenLane);
46614657
var isHiddenUpdate = updateLane !== update.lane; // Check if this update was made while the tree was hidden. If so, then
46624658
// it's not a "base" update and we should disregard the extra base lanes
@@ -4671,7 +4667,6 @@ function processUpdateQueue(workInProgress, props, instance, renderLanes) {
46714667
// skipped update, the previous update/state is the new base
46724668
// update/state.
46734669
var clone = {
4674-
eventTime: updateEventTime,
46754670
lane: updateLane,
46764671
tag: update.tag,
46774672
payload: update.payload,
@@ -4691,7 +4686,6 @@ function processUpdateQueue(workInProgress, props, instance, renderLanes) {
46914686
// This update does have sufficient priority.
46924687
if (newLastBaseUpdate !== null) {
46934688
var _clone = {
4694-
eventTime: updateEventTime,
46954689
// This update is going to be committed so we never want uncommit
46964690
// it. Using NoLane works because 0 is a subset of all bitmasks, so
46974691
// this will never be skipped by the check above.
@@ -9302,11 +9296,11 @@ function refreshCache(fiber, seedKey, seedValue) {
93029296
case HostRoot: {
93039297
// Schedule an update on the cache boundary to trigger a refresh.
93049298
var lane = requestUpdateLane(provider);
9305-
var eventTime = requestEventTime();
9306-
var refreshUpdate = createUpdate(eventTime, lane);
9299+
var refreshUpdate = createUpdate(lane);
93079300
var root = enqueueUpdate(provider, refreshUpdate, lane);
93089301

93099302
if (root !== null) {
9303+
var eventTime = requestEventTime();
93109304
scheduleUpdateOnFiber(root, provider, lane, eventTime);
93119305
entangleTransitions(root, provider, lane);
93129306
} // TODO: If a refresh never commits, the new cache created here must be
@@ -10915,9 +10909,8 @@ var classComponentUpdater = {
1091510909
// $FlowFixMe[missing-local-annot]
1091610910
enqueueSetState: function (inst, payload, callback) {
1091710911
var fiber = get(inst);
10918-
var eventTime = requestEventTime();
1091910912
var lane = requestUpdateLane(fiber);
10920-
var update = createUpdate(eventTime, lane);
10913+
var update = createUpdate(lane);
1092110914
update.payload = payload;
1092210915

1092310916
if (callback !== undefined && callback !== null) {
@@ -10931,6 +10924,7 @@ var classComponentUpdater = {
1093110924
var root = enqueueUpdate(fiber, update, lane);
1093210925

1093310926
if (root !== null) {
10927+
var eventTime = requestEventTime();
1093410928
scheduleUpdateOnFiber(root, fiber, lane, eventTime);
1093510929
entangleTransitions(root, fiber, lane);
1093610930
}
@@ -10950,9 +10944,8 @@ var classComponentUpdater = {
1095010944
},
1095110945
enqueueReplaceState: function (inst, payload, callback) {
1095210946
var fiber = get(inst);
10953-
var eventTime = requestEventTime();
1095410947
var lane = requestUpdateLane(fiber);
10955-
var update = createUpdate(eventTime, lane);
10948+
var update = createUpdate(lane);
1095610949
update.tag = ReplaceState;
1095710950
update.payload = payload;
1095810951

@@ -10967,6 +10960,7 @@ var classComponentUpdater = {
1096710960
var root = enqueueUpdate(fiber, update, lane);
1096810961

1096910962
if (root !== null) {
10963+
var eventTime = requestEventTime();
1097010964
scheduleUpdateOnFiber(root, fiber, lane, eventTime);
1097110965
entangleTransitions(root, fiber, lane);
1097210966
}
@@ -10987,9 +10981,8 @@ var classComponentUpdater = {
1098710981
// $FlowFixMe[missing-local-annot]
1098810982
enqueueForceUpdate: function (inst, callback) {
1098910983
var fiber = get(inst);
10990-
var eventTime = requestEventTime();
1099110984
var lane = requestUpdateLane(fiber);
10992-
var update = createUpdate(eventTime, lane);
10985+
var update = createUpdate(lane);
1099310986
update.tag = ForceUpdate;
1099410987

1099510988
if (callback !== undefined && callback !== null) {
@@ -11003,6 +10996,7 @@ var classComponentUpdater = {
1100310996
var root = enqueueUpdate(fiber, update, lane);
1100410997

1100510998
if (root !== null) {
10999+
var eventTime = requestEventTime();
1100611000
scheduleUpdateOnFiber(root, fiber, lane, eventTime);
1100711001
entangleTransitions(root, fiber, lane);
1100811002
}
@@ -12078,7 +12072,7 @@ function logCapturedError(boundary, errorInfo) {
1207812072
}
1207912073

1208012074
function createRootErrorUpdate(fiber, errorInfo, lane) {
12081-
var update = createUpdate(NoTimestamp, lane); // Unmount the root by rendering null.
12075+
var update = createUpdate(lane); // Unmount the root by rendering null.
1208212076

1208312077
update.tag = CaptureUpdate; // Caution: React DevTools currently depends on this property
1208412078
// being called "element".
@@ -12097,7 +12091,7 @@ function createRootErrorUpdate(fiber, errorInfo, lane) {
1209712091
}
1209812092

1209912093
function createClassErrorUpdate(fiber, errorInfo, lane) {
12100-
var update = createUpdate(NoTimestamp, lane);
12094+
var update = createUpdate(lane);
1210112095
update.tag = CaptureUpdate;
1210212096
var getDerivedStateFromError = fiber.type.getDerivedStateFromError;
1210312097

@@ -12257,7 +12251,7 @@ function markSuspenseBoundaryShouldCapture(
1225712251
// When we try rendering again, we should not reuse the current fiber,
1225812252
// since it's known to be in an inconsistent state. Use a force update to
1225912253
// prevent a bail out.
12260-
var update = createUpdate(NoTimestamp, SyncLane);
12254+
var update = createUpdate(SyncLane);
1226112255
update.tag = ForceUpdate;
1226212256
enqueueUpdate(sourceFiber, update, SyncLane);
1226312257
}
@@ -16444,7 +16438,7 @@ function propagateContextChange_eager(workInProgress, context, renderLanes) {
1644416438
if (fiber.tag === ClassComponent) {
1644516439
// Schedule a force update on the work-in-progress.
1644616440
var lane = pickArbitraryLane(renderLanes);
16447-
var update = createUpdate(NoTimestamp, lane);
16441+
var update = createUpdate(lane);
1644816442
update.tag = ForceUpdate; // TODO: Because we don't have a work-in-progress, this will add the
1644916443
// update to the current fiber, too, which means it will persist even if
1645016444
// this render is thrown away. Since it's a race condition, not sure it's
@@ -27517,7 +27511,6 @@ function updateContainer(element, container, parentComponent, callback) {
2751727511
}
2751827512

2751927513
var current$1 = container.current;
27520-
var eventTime = requestEventTime();
2752127514
var lane = requestUpdateLane(current$1);
2752227515

2752327516
if (enableSchedulingProfiler) {
@@ -27546,7 +27539,7 @@ function updateContainer(element, container, parentComponent, callback) {
2754627539
}
2754727540
}
2754827541

27549-
var update = createUpdate(eventTime, lane); // Caution: React DevTools currently depends on this property
27542+
var update = createUpdate(lane); // Caution: React DevTools currently depends on this property
2755027543
// being called "element".
2755127544

2755227545
update.payload = {
@@ -27571,6 +27564,7 @@ function updateContainer(element, container, parentComponent, callback) {
2757127564
var root = enqueueUpdate(current$1, update, lane);
2757227565

2757327566
if (root !== null) {
27567+
var eventTime = requestEventTime();
2757427568
scheduleUpdateOnFiber(root, current$1, lane, eventTime);
2757527569
entangleTransitions(root, current$1, lane);
2757627570
}

0 commit comments

Comments
 (0)