| @@ -420,16 +420,22 @@ | ||
| 420 | 420 | ]; |
| 421 | 421 | }, [statusFilter]); |
| 422 | 422 | |
| 423 | 423 | const handleBulkApply = async () => { |
| 424 | - if (!bulkAction || selectedIds.length === 0) { | |
| 425 | - showToast( | |
| 426 | - __("Please select items and a bulk action first.", "yatra"), | |
| 427 | - "error", | |
| 428 | - ); | |
| 424 | + // Report the input that is actually missing. The Apply button is disabled | |
| 425 | + // whenever nothing is selected, so this can only be reached with a non-empty | |
| 426 | + // selection — the combined message blamed the selection and left operators | |
| 427 | + // re-selecting rows that were already ticked. | |
| 428 | + if (selectedIds.length === 0) { | |
| 429 | + showToast(__("Please select at least one item.", "yatra"), "error"); | |
| 429 | 430 | return; |
| 430 | 431 | } |
| 431 | 432 | |
| 433 | + if (!bulkAction) { | |
| 434 | + showToast(__("Please choose a bulk action to apply.", "yatra"), "error"); | |
| 435 | + return; | |
| 436 | + } | |
| 437 | + | |
| 432 | 438 | try { |
| 433 | 439 | setBulkMutationPending(true); |
| 434 | 440 | |
| 435 | 441 | const selectedItems = items.filter((item: Item) => |
| @@ -660,9 +666,9 @@ | ||
| 660 | 666 | }); |
| 661 | 667 | } |
| 662 | 668 | |
| 663 | 669 | return actions; |
| 664 | - // eslint-disable-next-line react-hooks/exhaustive-deps | |
| 670 | + // eslint-disable-next-line react-hooks/exhaustive-deps | |
| 665 | 671 | }, [can, queryClient, showToast]); |
| 666 | 672 | |
| 667 | 673 | return ( |
| 668 | 674 | <div className="space-y-3"> |