parse-dashboard icon indicating copy to clipboard operation
parse-dashboard copied to clipboard

refactor: prevent usage of `this.state` inside `setState` calls

Open damianstasik opened this issue 3 years ago • 1 comments

New Pull Request Checklist

  • [x] I am not disclosing a vulnerability.
  • [x] I am creating this PR in reference to an issue.

Issue Description

This PR enables ESLint react/no-access-state-in-setstate rule that disallows access of this.state within setState calls. This can prevent nasty bugs caused by referencing old state, unfortunately while refactoring the code I spotted multiple direct this.state manipulations which should be also refactored as soon as possible to avoid unexpected behavior caused by for example concurrent rendering in React 18.

Related issue: #1950

Approach

TODOs before merging

  • [ ] Add tests
  • [ ] Add changes to documentation (guides, repository pages, in-code descriptions)
  • [x] A changelog entry is created automatically using the pull request title (do not manually add a changelog entry)

damianstasik avatar Oct 01 '22 13:10 damianstasik

Thanks for opening this pull request!

  • 🎉 We are excited about your hands-on contribution!