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

Create local rule to validate isMounted usage in useAsyncEffect #243

Open
grahamlangford opened this issue Feb 1, 2024 · 1 comment
Open

Comments

@grahamlangford
Copy link
Collaborator

Context

  • We use https://www.npmjs.com/package/use-async-effect throughout the Extension
  • The callback function has an isMounted function arg
  • It is easy to forget to invoke isMounted when working with useAsyncEffect
  • We should create a local eslint rule to ensure we remember to invoke isMounted
@fregante
Copy link
Collaborator

This might also be possible via types. It was annoyance for me too:

Side note: components should prefer cancelling work in progress wherever possible (which is rarely possible, actually) https://legacy.reactjs.org/blog/2015/12/16/ismounted-antipattern.html

@fregante fregante transferred this issue from pixiebrix/pixiebrix-extension Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants