Skip to content

Commit dd45378

Browse files
committed
Temporarily disable "long nested update" warning
DevTools' timeline profiler warns if an update inside a layout effect results in an expensive re-render. However, it misattributes renders that are spawned from a sync render at lower priority. This affects the new implementation of useDeferredValue but it would also apply to things like Offscreen. It's not obvious to me how to fix this given how DevTools models the idea of a "nested update" so I'm disabling the warning for now to unblock the bugfix for useDeferredValue.
1 parent dc73506 commit dd45378

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

packages/react-devtools-shared/src/__tests__/preprocessData-test.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1463,7 +1463,9 @@ describe('Timeline profiler', () => {
14631463
expect(event.warning).toBe(null);
14641464
});
14651465

1466-
it('should warn about long nested (state) updates during layout effects', async () => {
1466+
// This is temporarily disabled because the warning doesn't work
1467+
// with useDeferredValue
1468+
it.skip('should warn about long nested (state) updates during layout effects', async () => {
14671469
function Component() {
14681470
const [didMount, setDidMount] = React.useState(false);
14691471
Scheduler.unstable_yieldValue(
@@ -1523,7 +1525,9 @@ describe('Timeline profiler', () => {
15231525
);
15241526
});
15251527

1526-
it('should warn about long nested (forced) updates during layout effects', async () => {
1528+
// This is temporarily disabled because the warning doesn't work
1529+
// with useDeferredValue
1530+
it.skip('should warn about long nested (forced) updates during layout effects', async () => {
15271531
class Component extends React.Component {
15281532
_didMount: boolean = false;
15291533
componentDidMount() {
@@ -1654,7 +1658,9 @@ describe('Timeline profiler', () => {
16541658
});
16551659
});
16561660

1657-
it('should not warn about deferred value updates scheduled during commit phase', async () => {
1661+
// This is temporarily disabled because the warning doesn't work
1662+
// with useDeferredValue
1663+
it.skip('should not warn about deferred value updates scheduled during commit phase', async () => {
16581664
function Component() {
16591665
const [value, setValue] = React.useState(0);
16601666
const deferredValue = React.useDeferredValue(value);

packages/react-devtools-timeline/src/import-worker/preprocessData.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1124,7 +1124,10 @@ export default async function preprocessData(
11241124
lane => profilerData.laneToLabelMap.get(lane) === 'Transition',
11251125
)
11261126
) {
1127-
schedulingEvent.warning = WARNING_STRINGS.NESTED_UPDATE;
1127+
// FIXME: This warning doesn't account for "nested updates" that are
1128+
// spawned by useDeferredValue. Disabling temporarily until we figure
1129+
// out the right way to handle this.
1130+
// schedulingEvent.warning = WARNING_STRINGS.NESTED_UPDATE;
11281131
}
11291132
}
11301133
});

0 commit comments

Comments
 (0)