Skip to content

Prevent calculation on null childNode during resize observation#1784

Merged
thompsongl merged 3 commits into
elastic:masterfrom
thompsongl:bugfix/resize-childnode
Apr 2, 2019
Merged

Prevent calculation on null childNode during resize observation#1784
thompsongl merged 3 commits into
elastic:masterfrom
thompsongl:bugfix/resize-childnode

Conversation

@thompsongl
Copy link
Copy Markdown
Contributor

@thompsongl thompsongl commented Apr 1, 2019

Summary

elastic/kibana#34271 raises the case where EuiResizeObserver using the fallback MutationObserver API results in errors when the observed element is removed.

Two possible scenarios where this.childNode ref becomes null but onResize can still occur:

  1. prior to the initialization requestAnimationFrame
  2. prior to observer.disconnect() but onResize is already queued

Changes address the two above by calling disconnect before changing the childNode ref, and preventing calculations when childNode is null

Checklist

- [ ] This was checked in mobile
- [ ] This was checked in IE11
- [ ] This was checked in dark mode
- [ ] Any props added have proper autodocs
- [ ] Documentation examples were added

  • A changelog entry exists and is marked appropriately

- [ ] This was checked for breaking changes and labeled appropriately
- [ ] Jest tests were updated or added to match the most common scenarios
- [ ] This was checked against keyboard-only and screenreader scenarios
- [ ] This required updates to Framer X components

@thompsongl thompsongl changed the title prevent calculation on null childNode during resize observation Prevent calculation on null childNode during resize observation Apr 1, 2019
@thompsongl thompsongl requested a review from chandlerprall April 1, 2019 18:59
Copy link
Copy Markdown
Contributor

@chandlerprall chandlerprall left a comment

Choose a reason for hiding this comment

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

Changes LGTM; needs a changelog

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.

2 participants