Skip to content

fix: OPTIC-765: TypeError: Cannot read properties of null (reading 'getBoundingClientRect') #6109

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

Merged
merged 1 commit into from
Jul 22, 2024

Conversation

bmartel
Copy link
Contributor

@bmartel bmartel commented Jul 18, 2024

PR fulfills these requirements

  • Commit message(s) and PR title follows the format [fix|feat|ci|chore|doc]: TICKET-ID: Short description of change made ex. fix: DEV-XXXX: Removed inconsistent code usage causing intermittent errors
  • Best efforts were made to ensure docs/code are concise and coherent (checked for spelling/grammatical errors, commented out code, debug logs etc.)
  • Self-reviewed and ran all changes on a local instance (for bug fixes/features)

Change has impacts in these area(s)

(check all that apply)

  • Product design
  • Backend (Database)
  • Backend (API)
  • Frontend

What does this fix?

The Tooltip in certain circumstances could throw an error trying to align the position of an already unmounted component which threw the error in the PR title. Added a check to ensure this does not attempt to recalculate the position of the tooltip if either the trigger or tooltip component has unmounted from the DOM during the async transition. Also I cleaned up the deps arrays to remove any stable refs from here as it is not required.

Notes to reviewers

I was not able to reproduce this in any of the Tooltip usages I was able to determine. The Sentry stack trace points directly to this function being the culprit, and given the fact we have these async functions happening within useEffects without the guard proposed in this PR, it aligns with the type of behaviour that would result in this exact error.

@github-actions github-actions bot added the fix label Jul 18, 2024
Copy link

netlify bot commented Jul 18, 2024

Deploy Preview for label-studio-docs-new-theme canceled.

Name Link
🔨 Latest commit 32a699f
🔍 Latest deploy log https://app.netlify.com/sites/label-studio-docs-new-theme/deploys/6699716c641c440008d6dd6c

Copy link

netlify bot commented Jul 18, 2024

Deploy Preview for heartex-docs canceled.

Name Link
🔨 Latest commit 32a699f
🔍 Latest deploy log https://app.netlify.com/sites/heartex-docs/deploys/6699716ce8bc5e00083d13dc

@bmartel bmartel merged commit edc7968 into develop Jul 22, 2024
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants