Skip to content

Commit

Permalink
Temporarily disable "long nested update" warning
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
acdlite committed Apr 4, 2022
1 parent dc73506 commit dd45378
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
Expand Up @@ -1463,7 +1463,9 @@ describe('Timeline profiler', () => {
expect(event.warning).toBe(null);
});

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

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

it('should not warn about deferred value updates scheduled during commit phase', async () => {
// This is temporarily disabled because the warning doesn't work
// with useDeferredValue
it.skip('should not warn about deferred value updates scheduled during commit phase', async () => {
function Component() {
const [value, setValue] = React.useState(0);
const deferredValue = React.useDeferredValue(value);
Expand Down
Expand Up @@ -1124,7 +1124,10 @@ export default async function preprocessData(
lane => profilerData.laneToLabelMap.get(lane) === 'Transition',
)
) {
schedulingEvent.warning = WARNING_STRINGS.NESTED_UPDATE;
// FIXME: This warning doesn't account for "nested updates" that are
// spawned by useDeferredValue. Disabling temporarily until we figure
// out the right way to handle this.
// schedulingEvent.warning = WARNING_STRINGS.NESTED_UPDATE;
}
}
});
Expand Down

0 comments on commit dd45378

Please sign in to comment.