-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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 block error when transforming blocks with Link Popover opened #28136
Fix block error when transforming blocks with Link Popover opened #28136
Conversation
Size Change: +6 B (0%) Total Size: 1.28 MB
ℹ️ View Unchanged
|
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.
Makes sense
@@ -31,8 +31,10 @@ export function useAnchorRef( { ref, value, settings = {} } ) { | |||
const activeFormat = name ? getActiveFormat( value, name ) : undefined; | |||
|
|||
return useMemo( () => { | |||
const { ownerDocument } = ref.current; | |||
const { defaultView } = ownerDocument; | |||
if ( ! ref.current ) return; |
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.
When is this null? On first render?
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.
Seems like rewriting as a callback ref would fix it, this is typically the kind of bugs passing "ref" to hooks can create.
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.
(just a small remark, not necessarily for now)
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.
No. It's undefined
when clicking the transform item.
Description
Fixes: #28111
To reproduce
I'm not sure if there is a better fix here, but I'd love any ideas if you have any...
The change in code come from this PR: #26782