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

InspectorControlsSlot: remove unused framer motion context forwarding #67522

Merged
merged 2 commits into from
Dec 5, 2024
Merged
Changes from all 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
25 changes: 3 additions & 22 deletions packages/block-editor/src/components/inspector-controls/slot.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
/**
* WordPress dependencies
*/
import {
__experimentalUseSlotFills as useSlotFills,
__unstableMotionContext as MotionContext,
Copy link
Member

Choose a reason for hiding this comment

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

Now that we removed the last usage, I think this is a good time to remove the unstable MotionContext re-export:

MotionContext as __unstableMotionContext,

__unstableMotionContext,

Looks like there's no usage in plugins:

https://wpdirectory.net/search/01JE66GHXATVJHR1K7PQQG074W

Can be done in a separate PR IMHO.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm always hesitant about removing APIs, but that should be OK given that there are no usages.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

} from '@wordpress/components';
import { useContext, useMemo } from '@wordpress/element';
import { __experimentalUseSlotFills as useSlotFills } from '@wordpress/components';
import warning from '@wordpress/warning';
import deprecated from '@wordpress/deprecated';

Expand Down Expand Up @@ -37,19 +33,6 @@ export default function InspectorControlsSlot( {
const slotFill = groups[ group ];
const fills = useSlotFills( slotFill?.name );

const motionContextValue = useContext( MotionContext );

const computedFillProps = useMemo(
() => ( {
...fillProps,
forwardedContext: [
...( fillProps?.forwardedContext ?? [] ),
[ MotionContext.Provider, { value: motionContextValue } ],
],
} ),
[ motionContextValue, fillProps ]
);

if ( ! slotFill ) {
warning( `Unknown InspectorControls group "${ group }" provided.` );
return null;
Expand All @@ -66,14 +49,12 @@ export default function InspectorControlsSlot( {
<BlockSupportToolsPanel group={ group } label={ label }>
<BlockSupportSlotContainer
{ ...props }
fillProps={ computedFillProps }
fillProps={ fillProps }
Slot={ Slot }
/>
</BlockSupportToolsPanel>
);
}

return (
<Slot { ...props } fillProps={ computedFillProps } bubblesVirtually />
);
return <Slot { ...props } fillProps={ fillProps } bubblesVirtually />;
}
Loading