Skip to content

Commit

Permalink
Enable enableUnifiedSyncLane (#27646)
Browse files Browse the repository at this point in the history
<!--
  Thanks for submitting a pull request!
We appreciate you spending the time to work on these changes. Please
provide enough information so that others can review your pull request.
The three fields below are mandatory.

Before submitting a pull request, please make sure the following is
done:

1. Fork [the repository](https://github.com/facebook/react) and create
your branch from `main`.
  2. Run `yarn` in the repository root.
3. If you've fixed a bug or added code that should be tested, add tests!
4. Ensure the test suite passes (`yarn test`). Tip: `yarn test --watch
TestName` is helpful in development.
5. Run `yarn test --prod` to test in the production environment. It
supports the same options as `yarn test`.
6. If you need a debugger, run `yarn test --debug --watch TestName`,
open `chrome://inspect`, and press "Inspect".
7. Format your code with
[prettier](https://github.com/prettier/prettier) (`yarn prettier`).
8. Make sure your code lints (`yarn lint`). Tip: `yarn linc` to only
check changed files.
  9. Run the [Flow](https://flowtype.org/) type checks (`yarn flow`).
  10. If you haven't already, complete the CLA.

Learn more about contributing:
https://reactjs.org/docs/how-to-contribute.html
-->

## Summary

<!--
Explain the **motivation** for making this change. What existing problem
does the pull request solve?
-->
The flag has been tested internally on WWW, should be good to set to
true for OSS. Added a dynamic flag for fb RN.

## How did you test this change?

<!--
Demonstrate the code is solid. Example: The exact commands you ran and
their output, screenshots / videos if the pull request changes the user
interface.
How exactly did you verify that your PR solves the issue you wanted to
solve?
  If you leave this empty, your PR will very likely be closed.
-->
yarn test

DiffTrain build for commit 52d542a.
  • Loading branch information
tyao1 committed Nov 8, 2023
1 parent d8d66eb commit 819f58c
Show file tree
Hide file tree
Showing 13 changed files with 350 additions and 264 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<bb5ef5a2f4eb8edaae00d8385d079e76>>
* @generated SignedSource<<769546074522c131978074e9337b9413>>
*/

"use strict";
Expand Down Expand Up @@ -1078,7 +1078,7 @@ if (__DEV__) {
var DefaultLane =
/* */
32;
var SyncUpdateLanes = SyncLane;
var SyncUpdateLanes = SyncLane | InputContinuousLane | DefaultLane;
var TransitionHydrationLane =
/* */
64;
Expand Down Expand Up @@ -1173,6 +1173,14 @@ if (__DEV__) {
var nextRetryLane = RetryLane1;

function getHighestPriorityLanes(lanes) {
{
var pendingSyncLanes = lanes & SyncUpdateLanes;

if (pendingSyncLanes !== 0) {
return pendingSyncLanes;
}
}

switch (getHighestPriorityLane(lanes)) {
case SyncHydrationLane:
return SyncHydrationLane;
Expand Down Expand Up @@ -1771,7 +1779,9 @@ if (__DEV__) {
var renderLane = getHighestPriorityLane(renderLanes);
var lane;

{
if ((renderLane & SyncUpdateLanes) !== NoLane) {
lane = SyncHydrationLane;
} else {
switch (renderLane) {
case SyncLane:
lane = SyncHydrationLane;
Expand Down Expand Up @@ -25346,7 +25356,7 @@ if (__DEV__) {
return root;
}

var ReactVersion = "18.3.0-canary-2c8a139a5-20231107";
var ReactVersion = "18.3.0-canary-52d542ad6-20231107";

// Might add PROFILE later.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
@noflow
@nolint
@preventMunge
@generated SignedSource<<42aaf404bbde7ea71491676ec56cb0e1>>
@generated SignedSource<<64fea925e1f2075ccf9b0d7a53d3616f>>
*/
"use strict";
var React = require("react"),
Expand Down Expand Up @@ -302,6 +302,8 @@ function clz32Fallback(x) {
var nextTransitionLane = 128,
nextRetryLane = 4194304;
function getHighestPriorityLanes(lanes) {
var pendingSyncLanes = lanes & 42;
if (0 !== pendingSyncLanes) return pendingSyncLanes;
switch (lanes & -lanes) {
case 1:
return 1;
Expand Down Expand Up @@ -4357,43 +4359,46 @@ function updateDehydratedSuspenseComponent(
if (didReceiveUpdate || didSuspend) {
nextProps = workInProgressRoot;
if (null !== nextProps) {
switch (renderLanes & -renderLanes) {
case 2:
didSuspend = 1;
break;
case 8:
didSuspend = 4;
break;
case 32:
didSuspend = 16;
break;
case 128:
case 256:
case 512:
case 1024:
case 2048:
case 4096:
case 8192:
case 16384:
case 32768:
case 65536:
case 131072:
case 262144:
case 524288:
case 1048576:
case 2097152:
case 4194304:
case 8388608:
case 16777216:
case 33554432:
didSuspend = 64;
break;
case 268435456:
didSuspend = 134217728;
break;
default:
didSuspend = 0;
}
didSuspend = renderLanes & -renderLanes;
if (0 !== (didSuspend & 42)) didSuspend = 1;
else
switch (didSuspend) {
case 2:
didSuspend = 1;
break;
case 8:
didSuspend = 4;
break;
case 32:
didSuspend = 16;
break;
case 128:
case 256:
case 512:
case 1024:
case 2048:
case 4096:
case 8192:
case 16384:
case 32768:
case 65536:
case 131072:
case 262144:
case 524288:
case 1048576:
case 2097152:
case 4194304:
case 8388608:
case 16777216:
case 33554432:
didSuspend = 64;
break;
case 268435456:
didSuspend = 134217728;
break;
default:
didSuspend = 0;
}
didSuspend =
0 !== (didSuspend & (nextProps.suspendedLanes | renderLanes))
? 0
Expand Down Expand Up @@ -7717,7 +7722,7 @@ function commitRootImpl(
0 !== root.tag &&
flushPassiveEffects();
remainingLanes = root.pendingLanes;
0 !== (lanes & 4194218) && 0 !== (remainingLanes & 2)
0 !== (lanes & 4194218) && 0 !== (remainingLanes & 42)
? root === rootWithNestedUpdates
? nestedUpdateCount++
: ((nestedUpdateCount = 0), (rootWithNestedUpdates = root))
Expand Down Expand Up @@ -9039,7 +9044,7 @@ var devToolsConfig$jscomp$inline_1033 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-canary-2c8a139a5-20231107",
version: "18.3.0-canary-52d542ad6-20231107",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1226 = {
Expand Down Expand Up @@ -9070,7 +9075,7 @@ var internals$jscomp$inline_1226 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-canary-2c8a139a5-20231107"
reconcilerVersion: "18.3.0-canary-52d542ad6-20231107"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1227 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
@noflow
@nolint
@preventMunge
@generated SignedSource<<a6bb3bf359cbeea2e35d544470fb83f6>>
@generated SignedSource<<61b6979329b48da7cd49daaed19bd835>>
*/
"use strict";
var React = require("react"),
Expand Down Expand Up @@ -320,6 +320,8 @@ function clz32Fallback(x) {
var nextTransitionLane = 128,
nextRetryLane = 4194304;
function getHighestPriorityLanes(lanes) {
var pendingSyncLanes = lanes & 42;
if (0 !== pendingSyncLanes) return pendingSyncLanes;
switch (lanes & -lanes) {
case 1:
return 1;
Expand Down Expand Up @@ -4453,43 +4455,46 @@ function updateDehydratedSuspenseComponent(
if (didReceiveUpdate || didSuspend) {
nextProps = workInProgressRoot;
if (null !== nextProps) {
switch (renderLanes & -renderLanes) {
case 2:
didSuspend = 1;
break;
case 8:
didSuspend = 4;
break;
case 32:
didSuspend = 16;
break;
case 128:
case 256:
case 512:
case 1024:
case 2048:
case 4096:
case 8192:
case 16384:
case 32768:
case 65536:
case 131072:
case 262144:
case 524288:
case 1048576:
case 2097152:
case 4194304:
case 8388608:
case 16777216:
case 33554432:
didSuspend = 64;
break;
case 268435456:
didSuspend = 134217728;
break;
default:
didSuspend = 0;
}
didSuspend = renderLanes & -renderLanes;
if (0 !== (didSuspend & 42)) didSuspend = 1;
else
switch (didSuspend) {
case 2:
didSuspend = 1;
break;
case 8:
didSuspend = 4;
break;
case 32:
didSuspend = 16;
break;
case 128:
case 256:
case 512:
case 1024:
case 2048:
case 4096:
case 8192:
case 16384:
case 32768:
case 65536:
case 131072:
case 262144:
case 524288:
case 1048576:
case 2097152:
case 4194304:
case 8388608:
case 16777216:
case 33554432:
didSuspend = 64;
break;
case 268435456:
didSuspend = 134217728;
break;
default:
didSuspend = 0;
}
didSuspend =
0 !== (didSuspend & (nextProps.suspendedLanes | renderLanes))
? 0
Expand Down Expand Up @@ -8079,7 +8084,7 @@ function commitRootImpl(
0 !== root.tag &&
flushPassiveEffects();
remainingLanes = root.pendingLanes;
0 !== (lanes & 4194218) && 0 !== (remainingLanes & 2)
0 !== (lanes & 4194218) && 0 !== (remainingLanes & 42)
? ((nestedUpdateScheduled = !0),
root === rootWithNestedUpdates
? nestedUpdateCount++
Expand Down Expand Up @@ -9465,7 +9470,7 @@ var devToolsConfig$jscomp$inline_1075 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-canary-2c8a139a5-20231107",
version: "18.3.0-canary-52d542ad6-20231107",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1267 = {
Expand Down Expand Up @@ -9496,7 +9501,7 @@ var internals$jscomp$inline_1267 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-canary-2c8a139a5-20231107"
reconcilerVersion: "18.3.0-canary-52d542ad6-20231107"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1268 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ if (__DEV__) {
) {
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
}
var ReactVersion = "18.3.0-canary-2c8a139a5-20231107";
var ReactVersion = "18.3.0-canary-52d542ad6-20231107";

// ATTENTION
// When adding new symbols to this file,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -580,4 +580,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-canary-2c8a139a5-20231107";
exports.version = "18.3.0-canary-52d542ad6-20231107";
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-canary-2c8a139a5-20231107";
exports.version = "18.3.0-canary-52d542ad6-20231107";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2c8a139a593e0294c3a6953d74b451bd05fdcfca
52d542ad6d410008c495084f511247f43387055f
Loading

0 comments on commit 819f58c

Please sign in to comment.