From fc4bda773d82231163f84ccc6f69e899a0fec080 Mon Sep 17 00:00:00 2001 From: Sam Chau Date: Thu, 9 Jan 2025 17:10:51 +1030 Subject: [PATCH] fix: update mass import handling to use filtered and sorted format selections --- frontend/src/components/format/FormatPage.jsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/format/FormatPage.jsx b/frontend/src/components/format/FormatPage.jsx index aca22dc..fc4328f 100644 --- a/frontend/src/components/format/FormatPage.jsx +++ b/frontend/src/components/format/FormatPage.jsx @@ -207,7 +207,16 @@ function FormatPage() { const handleMassImport = async arr => { try { - const formatNames = Array.from(selectedItems); + // Get the filtered and sorted formats that were displayed during selection + const filteredFormats = getFilteredAndSortedFormats(); + + // Convert selected indexes to format file names using the filtered list + const selectedFormats = Array.from(selectedItems).map( + index => filteredFormats[index] + ); + + const formatNames = selectedFormats.map(format => format.file_name); + await importFormats(arr, formatNames); Alert.success('Formats imported successfully'); toggleSelectionMode();