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

Should we move away from UNSAFE_componentWillReceiveProps #173

Open
IMM9O opened this issue Nov 17, 2020 · 3 comments
Open

Should we move away from UNSAFE_componentWillReceiveProps #173

IMM9O opened this issue Nov 17, 2020 · 3 comments

Comments

@IMM9O
Copy link

IMM9O commented Nov 17, 2020

I want to address some adjustment improvement to remove the need for use UNSAFE_componentWillReceiveProps as it throws an error with react 17 and use shouldComponentUpdate method instance

and here my suggestion, it ok?

  shouldComponentUpdate (nextProps, nextState) {
    if (this.state.connected) {
      // Subscribe to new topics
      difference(nextProps.topics, this.props.topics).forEach((newTopic) => {
        this._log('Subscribing to topic: ' + newTopic)
        this._subscribe(newTopic)
      })

      // Unsubscribe from old topics
      difference(this.props.topics, nextProps.topics).forEach((oldTopic) => {
        this._log('Unsubscribing from topic: ' + oldTopic)
        this._unsubscribe(oldTopic)
      })
    }
    return false
  }
@AnthonyNGarcia
Copy link

Also seeing the same warning in browser console, would really like to see an update like this pulled in. An otherwise awesome tool here.

@lahsivjar
Copy link
Owner

Have been away from this project for a while, will take a look into this sometime next week.

@IncPlusPlus
Copy link

IncPlusPlus commented Apr 1, 2022

@lahsivjar Do you think this could be resolved if a pull request was made with the proposed changes? This could potentially close #133 and #195

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

No branches or pull requests

4 participants