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(sanity): ignore sticky overlay regions with a falsey DOM node #6910

Merged
merged 1 commit into from
Jun 13, 2024

Conversation

juice49
Copy link
Contributor

@juice49 juice49 commented Jun 12, 2024

Description

There have been some reports that the StickyOverlay component is being given regions that have no DOM node (instead, the element property is null). This causes an error when we attempt to read the scrollTop property of the element inside getOffsetsTo.

For affected users, this crashes the entire structure tool when it occurs.

I haven't yet been able to replicate this issue, nor determine the cause. We have a hook named useReporter that we use to track the position of field presence indicators. It passes up the value of a ref attached to a DOM node. That ref is read inside a layout effect, so it should never be null as far as I understand.

As an exploratory fix, I've added a condition to StickyOverlay to ignore any region that has a falsey DOM node. My hope is this will fix the immediate issue, and once verified, allow us to investigate the underlying cause.

What to review

Does this seem like a reasonable interim step to solve and confirm the problem?

Testing

In this instance, I haven't added or changed tests. I don't believe there is an existing test suite for the sticky presence indicators.

However, this branch only adds a filter to ignore any region that has a falsey DOM node. It's defensive and should only have an impact for affected Studios. In all other cases where sticky presence indicators were working, that should remain the case.

You can test this out by making sure the sticky presence indicators still work as expected.

Copy link

vercel bot commented Jun 12, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
page-building-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 12, 2024 3:26pm
performance-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 12, 2024 3:26pm
test-compiled-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 12, 2024 3:26pm
test-next-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 12, 2024 3:26pm
test-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 12, 2024 3:26pm
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
studio-workshop ⬜️ Ignored (Inspect) Jun 12, 2024 3:26pm

Copy link
Contributor

No changes to documentation

Copy link
Contributor

Component Testing Report Updated Jun 12, 2024 3:33 PM (UTC)

File Status Duration Passed Skipped Failed
comments/CommentInput.spec.tsx ✅ Passed (Inspect) 36s 15 0 0
formBuilder/ArrayInput.spec.tsx ✅ Passed (Inspect) 6s 3 0 0
formBuilder/inputs/PortableText/Annotations.spec.tsx ✅ Passed (Inspect) 26s 6 0 0
formBuilder/inputs/PortableText/copyPaste/CopyPaste.spec.tsx ✅ Passed (Inspect) 31s 11 7 0
formBuilder/inputs/PortableText/Decorators.spec.tsx ✅ Passed (Inspect) 13s 6 0 0
formBuilder/inputs/PortableText/DisableFocusAndUnset.spec.tsx ✅ Passed (Inspect) 8s 3 0 0
formBuilder/inputs/PortableText/DragAndDrop.spec.tsx ✅ Passed (Inspect) 45s 2 0 0
formBuilder/inputs/PortableText/FocusTracking.spec.tsx ✅ Passed (Inspect) 36s 15 0 0
formBuilder/inputs/PortableText/Input.spec.tsx ✅ Passed (Inspect) 1m 17s 21 0 0
formBuilder/inputs/PortableText/ObjectBlock.spec.tsx ✅ Passed (Inspect) 1m 4s 18 0 0
formBuilder/inputs/PortableText/PresenceCursors.spec.tsx ✅ Passed (Inspect) 7s 3 9 0
formBuilder/inputs/PortableText/RangeDecoration.spec.tsx ✅ Passed (Inspect) 20s 9 0 0
formBuilder/inputs/PortableText/Styles.spec.tsx ✅ Passed (Inspect) 14s 6 0 0
formBuilder/inputs/PortableText/Toolbar.spec.tsx ✅ Passed (Inspect) 29s 12 0 0

@juice49 juice49 marked this pull request as ready for review June 12, 2024 15:52
@juice49 juice49 requested a review from a team as a code owner June 12, 2024 15:52
@juice49 juice49 requested review from ricokahler, a team and binoy14 and removed request for a team and ricokahler June 12, 2024 15:52
Copy link
Member

@bjoerge bjoerge left a comment

Choose a reason for hiding this comment

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

Thanks!

@juice49 juice49 added this pull request to the merge queue Jun 13, 2024
Merged via the queue into next with commit 4f1be6c Jun 13, 2024
44 checks passed
@juice49 juice49 deleted the fix/sdx-1404/null-presence-element branch June 13, 2024 11:05
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