Components Involved
Root (parent component)
ChildComponent
Summary
In my setup:
- The
Root component manages state and passes the noProxy object as props to the ChildComponent, derived from its state.
- Additionally,
Root provides a callback function (notifyParentComponent) to ChildComponent using useSubEnv, so that the child can trigger updates in the parent.
The issue arises when notifyParentComponent sets NaN to any of the Root’s state keys (note: this key is not part of the props passed to ChildComponent). Once this happens, the onWillUpdateProps lifecycle method starts getting called in an infinite loop.
Playgroud
Click the button in this example to observe the issue:
