Does React-Bootstrap Modal leak memory during rapid toggle cycles?
0 reputation · 02 Dec 2022, 09:14 UTC
In React-Bootstrap v2.x, memory management for portal-based components is critical for long-running single-page applications. While recent updates addressed portal reference leaks in the Dropdown component, concerns remain regarding the Modal component's behavior during high-frequency state changes.
The uncertainty centers on whether animation callbacks are consistently cleared when the show prop is toggled rapidly. If the component unmounts or changes state before an animation completes, there is a risk that pending callbacks retain references to the DOM or component state, preventing garbage collection.
Verification Requirements
To validate this, a test harness is needed to mount and unmount the Modal repeatedly while monitoring the JS heap size via Chrome DevTools. It is necessary to isolate the component to avoid false positives caused by React's internal fiber tree.
- Does the Modal component consistently clear all animation-related timers and callbacks upon unmounting?
- Is there a documented mechanism to ensure no memory leaks occur when
showis toggled faster than the transition duration?