Bug
$onChanges can be called after $onDestroy during the same AngularJS digest cycle. This calls root.render() on an already-unmounted React root, producing the React 19 error: Cannot update an unmounted root.
React 18 silently ignored this, but React 19 made it a hard error.
Root cause
AngularJS does not guarantee that $onChanges won't fire after $onDestroy when both a binding change and component destruction occur in the same digest cycle.
Reproduction
- Angularized React component with bindings on a routed page
- Trigger an action that simultaneously:
- Changes a binding value (e.g. via
$rootScope.$broadcast → scope update)
- Navigates to a different route via
$location.path()
- Single digest processes both →
$onDestroy fires first (root.unmount()), then $onChanges fires (root.render() on unmounted root)
Suggested fix
Add a _destroyed flag in $onDestroy, guard $onChanges and $doCheck with early return. PR incoming.