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

Commit

Permalink
Select the correct inner button for the "Featured Item" button to upd…
Browse files Browse the repository at this point in the history
…ate its url (#6741)

* Select the correct id/attributes for the button to update its url

* Fix variables case
  • Loading branch information
albarin authored Jul 26, 2022
1 parent c39af21 commit 18c8e45
Showing 1 changed file with 5 additions and 5 deletions.
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

0 comments on commit 18c8e45

Please sign in to comment.