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

Fix: Data Views: bulk deleting causes a countdown experience in modal #64407

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Open
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
9 changes: 5 additions & 4 deletions packages/editor/src/dataviews/actions/trash-post.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useDispatch } from '@wordpress/data';
import { store as coreStore } from '@wordpress/core-data';
import { __, _n, sprintf, _x } from '@wordpress/i18n';
import { store as noticesStore } from '@wordpress/notices';
import { useState } from '@wordpress/element';
import { useRef, useState } from '@wordpress/element';
import {
Button,
__experimentalText as Text,
Expand Down Expand Up @@ -44,10 +44,11 @@ const trashPost: Action< PostWithPermissions > = {
const { createSuccessNotice, createErrorNotice } =
useDispatch( noticesStore );
const { deleteEntityRecord } = useDispatch( coreStore );
const initialItemCount = useRef( items.length );
return (
<VStack spacing="5">
<Text>
{ items.length === 1
{ initialItemCount.current === 1
? sprintf(
// translators: %s: The item's title.
__(
Expand All @@ -60,9 +61,9 @@ const trashPost: Action< PostWithPermissions > = {
_n(
'Are you sure you want to move %d item to the trash ?',
'Are you sure you want to move %d items to the trash ?',
items.length
initialItemCount.current
),
items.length
initialItemCount.current
) }
</Text>
<HStack justify="right">
Expand Down
Loading