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

Fix React warning about state update of unmounted component #136

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gamtiq
Copy link

@gamtiq gamtiq commented Aug 11, 2020

Hello,

I encountered the following React's warning when running unit tests for a component that is wrapping react-truncate:

Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method.

I researched and found that the problem is related to non-canceled requestAnimationFrame callback which asynchronously calls a function specified in onTruncate prop.
The proposed change eliminates the warning.

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

Successfully merging this pull request may close these issues.

1 participant