From 62c6631bc895b03f1c110fd907a74cc15e1b1533 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 10 Oct 2023 10:47:56 +0200 Subject: [PATCH] Don't cast on the fe --- .../TableNavigator/TableDataImport.svelte | 26 +------------------ 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/packages/builder/src/components/backend/TableNavigator/TableDataImport.svelte b/packages/builder/src/components/backend/TableNavigator/TableDataImport.svelte index 7bc53ad07b..a4794c1836 100644 --- a/packages/builder/src/components/backend/TableNavigator/TableDataImport.svelte +++ b/packages/builder/src/components/backend/TableNavigator/TableDataImport.svelte @@ -96,35 +96,11 @@ let validateHash = "" let errors = {} let selectedColumnTypes = {} - let rawRows = [] $: displayColumnOptions = Object.keys(schema || {}).filter(column => { return validation[column] }) - $: { - rows = [] - - for (const row of rawRows) { - const castedRow = { ...row } - for (const fieldSchema of Object.values(schema || {})) { - if (fieldSchema.type === FieldType.BB_REFERENCE) { - try { - castedRow[fieldSchema.name] = JSON.parse( - row[fieldSchema.name].replace(/'/g, '"') - ) - } catch { - console.warn("Not a valid json", { - field: fieldSchema.name, - data: row[fieldSchema.name], - }) - } - } - } - rows.push(castedRow) - } - } - $: { // binding in consumer is causing double renders here const newValidateHash = JSON.stringify(rows) + JSON.stringify(schema) @@ -142,7 +118,7 @@ try { const response = await parseFile(e) - rawRows = response.rows + rows = response.rows schema = response.schema fileName = response.fileName selectedColumnTypes = Object.entries(response.schema).reduce(