@@ -282,64 +282,44 @@ export function createValidationSummary(
282282
283283/**
284284 * Bulk tag validation for CSV import
285- * Validates all CSV rows against available tag groups and provides progress feedback
285+ * Validates all CSV rows against available tag groups
286286 *
287287 * @param csvData - Array of parsed CSV rows with tag groups
288288 * @param availableTagGroups - Available tag groups from backend
289- * @param onProgress - Optional callback for progress updates (processedRows, totalRows)
290289 * @returns Validation results with rejected groups and values
291290 */
292291export interface BulkTagValidationResult {
293292 rejectedGroups : string [ ] ;
294293 rejectedValues : Record < string , string [ ] > ;
295294}
296295
297- export async function validateCSVTags (
296+ export function validateCSVTags (
298297 csvData : ParsedCSVRow [ ] ,
299298 availableTagGroups : Array < {
300299 id : string ;
301300 name : string ;
302301 tags : Array < { id : string ; name : string } > ;
303- } > ,
304- onProgress ?: ( processedRows : number , totalRows : number ) => void
305- ) : Promise < BulkTagValidationResult > {
302+ } >
303+ ) : BulkTagValidationResult {
306304 // Collect all rejected groups and values across all rows
307305 const allRejectedGroups = new Set < string > ( ) ;
308306 const allRejectedValues : Record < string , Set < string > > = { } ;
309307
310- // Process validation in chunks to prevent blocking the main thread
311- const chunkSize = 50 ;
312- const totalRows = csvData . length ;
308+ // Process each row
309+ csvData . forEach ( ( row ) => {
310+ const mapping = createTagMapping ( row . groups , availableTagGroups ) ;
313311
314- for ( let start = 0 ; start < csvData . length ; start += chunkSize ) {
315- const chunk = csvData . slice ( start , start + chunkSize ) ;
312+ // Collect rejected groups (groups that don't exist in backend)
313+ mapping . rejectedGroups . forEach ( ( group ) => allRejectedGroups . add ( group ) ) ;
316314
317- // Process each row in the current chunk
318- chunk . forEach ( ( row ) => {
319- const mapping = createTagMapping ( row . groups , availableTagGroups ) ;
320-
321- // Collect rejected groups (groups that don't exist in backend)
322- mapping . rejectedGroups . forEach ( ( group ) => allRejectedGroups . add ( group ) ) ;
323-
324- // Collect rejected values (values that don't exist for their group in backend)
325- Object . entries ( mapping . rejectedValues ) . forEach ( ( [ group , values ] ) => {
326- if ( ! allRejectedValues [ group ] ) {
327- allRejectedValues [ group ] = new Set ( ) ;
328- }
329- values . forEach ( ( value ) => allRejectedValues [ group ] . add ( value ) ) ;
330- } ) ;
315+ // Collect rejected values (values that don't exist for their group in backend)
316+ Object . entries ( mapping . rejectedValues ) . forEach ( ( [ group , values ] ) => {
317+ if ( ! allRejectedValues [ group ] ) {
318+ allRejectedValues [ group ] = new Set ( ) ;
319+ }
320+ values . forEach ( ( value ) => allRejectedValues [ group ] . add ( value ) ) ;
331321 } ) ;
332-
333- // Update progress indicator for real-time UI feedback
334- const processedRows = Math . min ( start + chunk . length , totalRows ) ;
335- if ( onProgress ) {
336- onProgress ( processedRows , totalRows ) ;
337- }
338-
339- // Yield control to allow UI updates and prevent blocking
340- // eslint-disable-next-line no-await-in-loop, no-promise-executor-return
341- await new Promise ( ( resolve ) => setTimeout ( resolve , 0 ) ) ;
342- }
322+ } ) ;
343323
344324 // Convert sets to arrays
345325 const rejectedGroups = Array . from ( allRejectedGroups ) ;
0 commit comments