Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Select the correct inner button for the "Featured Item" button to update its url #6741

Merged
merged 2 commits into from
Jul 26, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ export const withUpdateButtonAttributes =
( item as WP_REST_API_Category )?.link ||
( item as ProductResponseItem )?.permalink;

const Block = useSelect( ( select ) => {
const block = useSelect( ( select ) => {
return select( 'core/block-editor' ).getBlock( clientId );
} );
const InnerButton = Block?.innerBlocks[ 0 ];
const buttonBlockId = InnerButton?.clientId || '';
const innerBlock = block?.innerBlocks[ 0 ]?.innerBlocks[ 0 ];
const buttonBlockId = innerBlock?.clientId || '';
const currentButtonAttributes = useMemo(
() => InnerButton?.attributes || {},
[ InnerButton ]
() => innerBlock?.attributes || {},
[ innerBlock ]
);
const { url } = currentButtonAttributes;

Expand Down