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

Exclude references to this.state in setState callback #1610

Merged
merged 2 commits into from Jan 31, 2018

Conversation

pfhayes
Copy link
Contributor

@pfhayes pfhayes commented Dec 15, 2017

No description provided.

@pfhayes
Copy link
Contributor Author

pfhayes commented Dec 15, 2017

Addresses #1604

Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems legit, thanks

@pfhayes
Copy link
Contributor Author

pfhayes commented Jan 30, 2018

Any updates on this? This bug is still present in 7.6.1

@ljharb ljharb merged commit 70e8a02 into jsx-eslint:master Jan 31, 2018
@wenzelua
Copy link

The bug is still present in 7.7.0

@pfhayes
Copy link
Contributor Author

pfhayes commented Mar 22, 2018

@SlaUA can you supply an example that reproduces the issue? I have not witnessed this

@wenzelua
Copy link

Looks like I faced with cache...

@Aequitas737
Copy link

Aequitas737 commented Aug 14, 2018

Still present in 7.10.0 when the callback calls a function which references this.state.

myFunc = () => {
   this.setState({
            ...prop,
        }, () => this.doStuff());
    }

    doStuff= () => {
        console.log(this.state.asdf);
    }

Can work around this by just passing this.state into doStuff: this.doStuff(this.state)

@ljharb
Copy link
Member

ljharb commented Aug 14, 2018

@Aequitas737 altho you shouldn't put arrow functions in class fields, that seems like it should work. Can you file a new issue?

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

Successfully merging this pull request may close these issues.

None yet

4 participants