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

DFW: reset zombie state on unmount #67076

Open
wants to merge 4 commits into
base: trunk
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ export default function CollapsibleBlockToolbar( { isCollapsed, onToggle } ) {
}
}, [ blockSelectionStart, onToggle ] );
Copy link
Member Author

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.


// Reset isCollapsed when the collapsible block toolbar unmounts. It is true
// by default.
useEffect(
() => () => {
onToggle( true );
Copy link
Contributor

Choose a reason for hiding this comment

The 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)

Copy link
Member Author

Choose a reason for hiding this comment

The 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.

Copy link
Member Author

Choose a reason for hiding this comment

The 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;
}
Expand Down
Loading