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

shouldComponentUpdate clauses should be flattened. #419

Closed
shammamah-zz opened this issue Sep 19, 2019 · 0 comments
Closed

shouldComponentUpdate clauses should be flattened. #419

shammamah-zz opened this issue Sep 19, 2019 · 0 comments

Comments

@shammamah-zz
Copy link
Contributor

No obligation here but would suggest flattening this for readability.
Same comment applies to other shouldComponentUpdate.

shouldComponentUpdate(nextProps) {
    if (this.props.modelData !== nextProps.modelData) {
        return true;
    }

    // if one is defined but not the other (XOR)
    if (this.props.selectedAtomIds ? !nextProps.selectedAtomIds : nextProps.selectedAtomIds) {
        return true;
    }

    // etc.
}

Originally posted by @Marc-Andre-Rivet in #411

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

2 participants