-
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
DFW: reset zombie state on unmount #67076
base: trunk
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,6 +42,15 @@ export default function CollapsibleBlockToolbar( { isCollapsed, onToggle } ) { | |
} | ||
}, [ blockSelectionStart, onToggle ] ); | ||
|
||
// Reset isCollapsed when the collapsible block toolbar unmounts. It is true | ||
// by default. | ||
useEffect( | ||
() => () => { | ||
onToggle( true ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It doesn't feel like the right place to call this for me. It should be the responsibility of the parent component IMO (unless the state is moved to within this component) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The thing is that the parent component never sets this state, it appears it's only used inside this one. But the parent component needs to be aware of it to hide the document bar. Tbh, I think the local state is bad here, it should probably be done differently. I just didn't feel like refactoring it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I changed the whole thing to use CSS. |
||
}, | ||
[ onToggle ] | ||
); | ||
|
||
if ( ! hasBlockToolbar ) { | ||
return 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.
Oh, I think we'll want to keep this. It should uncollapse whenever you change selection I guess.