video-react icon indicating copy to clipboard operation
video-react copied to clipboard

Memory leak from Player and Bezel components not unsubscribing from redux store

Open jialu98 opened this issue 2 years ago • 0 comments

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

jialu98 avatar Feb 07 '23 01:02 jialu98