-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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 error when reloading while saving a pattern #62082
Fix error when reloading while saving a pattern #62082
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Size Change: +2 B (0%) Total Size: 1.74 MB
ℹ️ View Unchanged
|
Flaky tests detected in 6c76bb9. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/9280653991
|
@@ -10,7 +10,7 @@ export function useScrollIntoView( { isSelected } ) { | |||
if ( isSelected ) { | |||
const { ownerDocument } = node; | |||
const { defaultView } = ownerDocument; | |||
if ( ! defaultView.IntersectionObserver ) { | |||
if ( ! defaultView?.IntersectionObserver ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What causes defaultView
to be null?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this just in test or also manually reproducible?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's some more discussion over here - #61941 (comment).
Not entirely sure what causes it, but my best guess is it's a side effect of the page unload, maybe the DOM elements being detached from the DOM.
Not really sure if it's something we need to fix. I just put the PR to demonstrate that the error goes away after this change for that e2e test.
What?
See #61941
An error is currently happening when running the synced patterns e2e test. It's likely to not cause any user facing issues, but can be addressed.
How?
On this line there's a chance
defaultView
is null-ish, so we should check for that before trying to access theIntersectionObserver
property in the early return.Testing Instructions
Run the synced patterns e2e tests:
and trigger the
can be inserted after refresh
test case. The error shouldn't happen