Skip to content

[devtools] Prevent incorrect render detection for user components in didFiberRender (#33423) #33434

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion packages/react-devtools-shared/src/backend/fiber/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1885,7 +1885,20 @@ export function attach(
// releasing DevTools in lockstep with React, we should import a
// function from the reconciler instead.
const PerformedWork = 0b000000000000000000000000001;
return (getFiberFlags(nextFiber) & PerformedWork) === PerformedWork;
if ((getFiberFlags(nextFiber) & PerformedWork) === 0) {
return false;
}
if (
prevFiber != null &&
prevFiber.memoizedProps === nextFiber.memoizedProps &&
prevFiber.memoizedState === nextFiber.memoizedState &&
prevFiber.ref === nextFiber.ref
) {
// React may mark PerformedWork even if we bailed out. Double check
// that inputs actually changed before reporting a render.
return false;
}
return true;
// Note: ContextConsumer only gets PerformedWork effect in 16.3.3+
// so it won't get highlighted with React 16.3.0 to 16.3.2.
default:
Expand Down
Loading