Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jialu98 opened this issue Feb 7, 2023 · 0 comments

Comments

@jialu98
Copy link

jialu98 commented Feb 7, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant