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: Attempt to measure component after it has been unmounted #10

Merged
merged 2 commits into from
Oct 28, 2019

Conversation

matt-d-rat
Copy link
Owner

Description

This PR fixes an issue where the MiddleTruncate component is unmounted, but still attempts to read the measurements of the component in order to parse the text for truncation. This scenario could occur when the onResize event listener was triggered, but the component was unmounted before the debounced onResize handler was called.

  • Added sensible defaults to ensure we always return numeric values if for some reason we cannot get the measurements of the component.
  • Cancel the debounced onResize and parseTextForTruncation when the component is unmounted.

…unmount

- Added sensible defaults to ensure we return numeric values if for some reason we cannot get the measurements of the component
- Cancel the debounced onResize and parseTextForTruncation when the component unmounts
@matt-d-rat matt-d-rat added the bug Something isn't working label Oct 28, 2019
@matt-d-rat matt-d-rat self-assigned this Oct 28, 2019
@matt-d-rat matt-d-rat merged commit 2d5949d into master Oct 28, 2019
@matt-d-rat matt-d-rat deleted the bug/offset-of-null-safety-checks branch October 28, 2019 00:25
@matt-d-rat matt-d-rat mentioned this pull request Oct 28, 2019
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant