Skip to content

Commit 7943da1

Browse files
authored
Set accurate value for alwaysThrottleRetries on www (#32684)
This flag value was updated in #28965 (seemingly unrelated, maybe as part of unit testing). But its still controlled by a dynamic flag in www. Let's update this to VARIANT to accurately represent the state of the rollout. Before: <img width="1340" alt="Screenshot 2025-03-20 at 10 45 30 AM" src="https://github.com/user-attachments/assets/d0405a36-eb71-4108-9e23-8d462cc68fb4" /> After: <img width="1351" alt="Screenshot 2025-03-20 at 10 45 11 AM" src="https://github.com/user-attachments/assets/459d260d-7a25-430b-95a6-d6a91d958417" />
1 parent e3c0642 commit 7943da1

File tree

2 files changed

+52
-49
lines changed

2 files changed

+52
-49
lines changed

packages/react-dom/src/__tests__/ReactDOMFloat-test.js

+51-48
Original file line numberDiff line numberDiff line change
@@ -3360,27 +3360,29 @@ body {
33603360
});
33613361
await waitForAll([]);
33623362

3363-
// Although the commit suspended, a preload was inserted.
3364-
expect(getMeaningfulChildren(document)).toEqual(
3365-
<html>
3366-
<head>
3367-
<link rel="preload" href="foo" as="style" />
3368-
</head>
3369-
<body>loading...</body>
3370-
</html>,
3371-
);
3363+
if (gate(flags => flags.alwaysThrottleRetries)) {
3364+
// Although the commit suspended, a preload was inserted.
3365+
expect(getMeaningfulChildren(document)).toEqual(
3366+
<html>
3367+
<head>
3368+
<link rel="preload" href="foo" as="style" />
3369+
</head>
3370+
<body>loading...</body>
3371+
</html>,
3372+
);
33723373

3373-
loadPreloads(['foo']);
3374-
assertLog(['load preload: foo']);
3375-
expect(getMeaningfulChildren(document)).toEqual(
3376-
<html>
3377-
<head>
3378-
<link rel="stylesheet" href="foo" data-precedence="default" />
3379-
<link rel="preload" href="foo" as="style" />
3380-
</head>
3381-
<body>loading...</body>
3382-
</html>,
3383-
);
3374+
loadPreloads(['foo']);
3375+
assertLog(['load preload: foo']);
3376+
expect(getMeaningfulChildren(document)).toEqual(
3377+
<html>
3378+
<head>
3379+
<link rel="stylesheet" href="foo" data-precedence="default" />
3380+
<link rel="preload" href="foo" as="style" />
3381+
</head>
3382+
<body>loading...</body>
3383+
</html>,
3384+
);
3385+
}
33843386

33853387
loadStylesheets(['foo']);
33863388
assertLog(['load stylesheet: foo']);
@@ -3410,35 +3412,36 @@ body {
34103412
);
34113413
});
34123414
await waitForAll([]);
3413-
expect(getMeaningfulChildren(document)).toEqual(
3414-
<html>
3415-
<head>
3416-
<link rel="stylesheet" href="foo" data-precedence="default" />
3417-
<link rel="preload" href="foo" as="style" />
3418-
<link rel="preload" href="bar" as="style" />
3419-
</head>
3420-
<body>
3421-
<div style="display: none;">hello</div>loading...
3422-
</body>
3423-
</html>,
3424-
);
3425-
3426-
loadPreloads(['bar']);
3427-
assertLog(['load preload: bar']);
3428-
expect(getMeaningfulChildren(document)).toEqual(
3429-
<html>
3430-
<head>
3431-
<link rel="stylesheet" href="foo" data-precedence="default" />
3432-
<link rel="stylesheet" href="bar" data-precedence="default" />
3433-
<link rel="preload" href="foo" as="style" />
3434-
<link rel="preload" href="bar" as="style" />
3435-
</head>
3436-
<body>
3437-
<div style="display: none;">hello</div>loading...
3438-
</body>
3439-
</html>,
3440-
);
3415+
if (gate(flags => flags.alwaysThrottleRetries)) {
3416+
expect(getMeaningfulChildren(document)).toEqual(
3417+
<html>
3418+
<head>
3419+
<link rel="stylesheet" href="foo" data-precedence="default" />
3420+
<link rel="preload" href="foo" as="style" />
3421+
<link rel="preload" href="bar" as="style" />
3422+
</head>
3423+
<body>
3424+
<div style="display: none;">hello</div>loading...
3425+
</body>
3426+
</html>,
3427+
);
34413428

3429+
loadPreloads(['bar']);
3430+
assertLog(['load preload: bar']);
3431+
expect(getMeaningfulChildren(document)).toEqual(
3432+
<html>
3433+
<head>
3434+
<link rel="stylesheet" href="foo" data-precedence="default" />
3435+
<link rel="stylesheet" href="bar" data-precedence="default" />
3436+
<link rel="preload" href="foo" as="style" />
3437+
<link rel="preload" href="bar" as="style" />
3438+
</head>
3439+
<body>
3440+
<div style="display: none;">hello</div>loading...
3441+
</body>
3442+
</html>,
3443+
);
3444+
}
34423445
loadStylesheets(['bar']);
34433446
assertLog(['load stylesheet: bar']);
34443447
expect(getMeaningfulChildren(document)).toEqual(

packages/shared/forks/ReactFeatureFlags.www-dynamic.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// Use __VARIANT__ to simulate a GK. The tests will be run twice: once
1414
// with the __VARIANT__ set to `true`, and once set to `false`.
1515

16-
export const alwaysThrottleRetries = true;
16+
export const alwaysThrottleRetries = __VARIANT__;
1717
export const disableDefaultPropsExceptForClasses = __VARIANT__;
1818
export const disableLegacyContextForFunctionComponents = __VARIANT__;
1919
export const disableSchedulerTimeoutInWorkLoop = __VARIANT__;

0 commit comments

Comments
 (0)