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:

Components Involved
Root(parent component)ChildComponentSummary
In my setup:
Rootcomponent manages state and passes the noProxy object as props to the ChildComponent, derived from its state.Rootprovides a callback function (notifyParentComponent) toChildComponentusinguseSubEnv, so that the child can trigger updates in the parent.The issue arises when
notifyParentComponentsetsNaNto any of theRoot’s state keys (note: this key is not part of the props passed toChildComponent). Once this happens, theonWillUpdatePropslifecycle method starts getting called in an infinite loop.Playgroud
Click the button in this example to observe the issue:
