video-react
video-react copied to clipboard
Memory leak from Player and Bezel components not unsubscribing from redux store
Describe the bug Player and Bezel do not unsubscribe from the redux store, causing a memory leak. This can be remedied by removing the subscription from constructor, and subscribing to the store in the ComponentDidMount(), and unsubscribing in the ComponentWillUnmount()
Player.js
componentDidMount() {
this.unsubscribe = this.manager.subscribeToPlayerStateChange(this.handleStateChange);
}
ComponentWillUnmount() {
this.unsubscribe();
}
Bezel.js
componentDidMount() {
this.unsubscribe = this.manager.subscribeToOperationStateChange(this.handleStateChange);
}
ComponentWillUnmount() {
this.unsubscribe();
}
To Reproduce Steps to reproduce the behavior: Create a Player component by passing a store. When player is unmounted, Player does not unsubscribe from the redux store
Expected behavior Player and Bezel unsubscribe from the redux store
Screenshots
Desktop (please complete the following information):
- OS: macOS Monterey
- Browser chrome
- Version 12.6.3
Additional context
Demo