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

Commit

Permalink
Fix undo button (#9478)
Browse files Browse the repository at this point in the history
* fix undo button

* fix label
  • Loading branch information
gigitux authored May 17, 2023
1 parent 1c575d4 commit 79c9459
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
13 changes: 6 additions & 7 deletions assets/js/blocks/classic-template/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { Button, Placeholder, Popover } from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import { box, Icon } from '@wordpress/icons';
import { useDispatch, subscribe, useSelect, select } from '@wordpress/data';
import { useEffect, useMemo, useState } from '@wordpress/element';
import { useEffect, useState } from '@wordpress/element';
import { store as noticesStore } from '@wordpress/notices';
import { useEntityRecord } from '@wordpress/core-data';

Expand Down Expand Up @@ -100,12 +100,6 @@ const Edit = ( {

const { createInfoNotice } = useDispatch( noticesStore );

const blocks = getBlocks();

const clientIds = useMemo( () => {
pickBlockClientIds( blocks );
}, [ blocks ] );

const blockProps = useBlockProps();
const templateDetails = getTemplateDetailsBySlug(
attributes.template,
Expand Down Expand Up @@ -177,6 +171,11 @@ const Edit = ( {
'woo-gutenberg-products-block'
),
onClick: () => {
const clientIds =
pickBlockClientIds(
getBlocks()
);

replaceBlocks(
clientIds,
createBlock(
Expand Down
2 changes: 1 addition & 1 deletion assets/js/blocks/classic-template/single-product.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const getDescriptionAllowingConversion = ( templateTitle: string ) =>
sprintf(
/* translators: %s is the template title */
__(
'Transform this template into multiple blocks so you can add, remove, reorder, and customize your %s.',
'Transform this template into multiple blocks so you can add, remove, reorder, and customize your %s template.',
'woo-gutenberg-products-block'
),
templateTitle
Expand Down

0 comments on commit 79c9459

Please sign in to comment.