Closed
Description
React version: 17.0.2
Devtools version: 4.21.0.1 (FB build)
Steps To Reproduce
- Open sandbox (source)
- Start profiling with 'Record why each component rendered while profiling' enabled.
- Click the page a few times to force renders.
- Stop profiling and view 'Why did this render?' panel
Link to code example:
https://codesandbox.io/s/react-playground-forked-lke58
The current behavior
The profiler says the component rendered because the parent component rendered. This is incorrect, as the parent component is a MemoComponent that did in fact not render.
The expected behavior
The component actually rendered because its context was changed. When digging into the devtools code, we are checking the memoizedValue value on the context, which doesn't seem to exist.
while (prevContext && nextContext) {
if (!is(prevContext.memoizedValue, nextContext.memoizedValue)) {
return true;
}
prevContext = prevContext.next;
nextContext = nextContext.next;
}
I couldn't find the actual value on the context property; or in the memoizedState.