From 2c2a416d1dd8e4cd3141116fd6eb0344e19a53a8 Mon Sep 17 00:00:00 2001 From: Florent MILLOT <75525996+flomillot@users.noreply.github.com> Date: Mon, 29 Jun 2026 18:16:59 +0200 Subject: [PATCH 1/2] Clear file state on equipment type change in tabular forms In the tabular and limit-sets modification forms, the file/import state (selected file, file error/warning, CSV filename) was only reset through resetOnConfirmation, which runs only when the confirmation popup opens (i.e. when the table is non-empty). Changing the type on an empty table skipped the popup and left a stale selected file or file message from the previous type. Split the reset: the destructive table/properties reset stays behind confirmation (resetOnConfirmation), while the file state is now cleared on every type change through the new resetOnChange prop of InputWithPopupConfirmation. Co-Authored-By: Claude Opus 4.8 Signed-off-by: Florent MILLOT <75525996+flomillot@users.noreply.github.com> --- .../limit-sets-tabular-modification-form.tsx | 15 ++++++++++----- .../tabular/tabular-form.tsx | 15 ++++++++++----- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/components/dialogs/network-modifications/limit-sets/limit-sets-tabular-modification-form.tsx b/src/components/dialogs/network-modifications/limit-sets/limit-sets-tabular-modification-form.tsx index a5ff0c581e..8bedfa28ed 100644 --- a/src/components/dialogs/network-modifications/limit-sets/limit-sets-tabular-modification-form.tsx +++ b/src/components/dialogs/network-modifications/limit-sets/limit-sets-tabular-modification-form.tsx @@ -193,13 +193,16 @@ export function LimitSetsTabularModificationForm({ dataFetching }: Readonly { - clearErrors(MODIFICATIONS_TABLE); - tableRef.current?.replace([]); + const resetFileStateOnTypeChange = useCallback(() => { setValue(CSV_FILENAME, undefined); setSelectedFile(undefined); setFileErrorMessage(undefined); - }, [clearErrors, setValue]); + }, [setValue]); + + const resetFormStateOnTypeChange = useCallback(() => { + clearErrors(MODIFICATIONS_TABLE); + tableRef.current?.replace([]); + }, [clearErrors]); const csvFilename = getValues(CSV_FILENAME); @@ -225,7 +228,8 @@ export function LimitSetsTabularModificationForm({ dataFetching }: Readonly hasNonEmptyRows(getValues(MODIFICATIONS_TABLE))} - resetOnConfirmation={handleChangeType} + resetOnChange={resetFileStateOnTypeChange} + resetOnConfirmation={resetFormStateOnTypeChange} message="changeTypeMessage" validateButtonLabel="button.changeType" /> @@ -294,6 +298,7 @@ export function LimitSetsTabularModificationForm({ dataFetching }: Readonly> label="UploadCSV" header={csvColumns.map((column) => column.id)} + allowMissingColumns disabled={!equipmentType} language={language} parseConfig={parseConfig} diff --git a/src/components/dialogs/network-modifications/tabular/tabular-form.tsx b/src/components/dialogs/network-modifications/tabular/tabular-form.tsx index 276952d74b..f9eba3d27d 100644 --- a/src/components/dialogs/network-modifications/tabular/tabular-form.tsx +++ b/src/components/dialogs/network-modifications/tabular/tabular-form.tsx @@ -413,14 +413,17 @@ export function TabularForm({ dataFetching, dialogMode }: Readonly { - clearErrors(MODIFICATIONS_TABLE); - tableRef.current?.replace([]); + const resetFileStateOnTypeChange = useCallback(() => { setValue(CSV_FILENAME, undefined); - setValue(TABULAR_PROPERTIES, []); setSelectedFile(undefined); setFileErrorMessage(undefined); setFileWarningMessage(undefined); + }, [setValue]); + + const resetFormStateOnTypeChange = useCallback(() => { + clearErrors(MODIFICATIONS_TABLE); + tableRef.current?.replace([]); + setValue(TABULAR_PROPERTIES, []); }, [clearErrors, setValue]); const equipmentTypeField = ( @@ -433,7 +436,8 @@ export function TabularForm({ dataFetching, dialogMode }: Readonly hasNonEmptyRows(getValues(MODIFICATIONS_TABLE))} - resetOnConfirmation={handleChangeType} + resetOnChange={resetFileStateOnTypeChange} + resetOnConfirmation={resetFormStateOnTypeChange} message="changeTypeMessage" validateButtonLabel="button.changeType" /> @@ -559,6 +563,7 @@ export function TabularForm({ dataFetching, dialogMode }: Readonly> label="UploadCSV" header={csvColumns} + allowMissingColumns disabled={!equipmentType} language={language} parseConfig={parseConfig} From 076576f818505ad285469f486f5de765b148a4eb Mon Sep 17 00:00:00 2001 From: Florent MILLOT <75525996+flomillot@users.noreply.github.com> Date: Mon, 29 Jun 2026 20:01:13 +0200 Subject: [PATCH 2/2] Remove CSV allowMissingColumns from tabular forms This tolerance is handled in a dedicated change; drop it here to avoid duplicating it across pull requests. Signed-off-by: Florent MILLOT <75525996+flomillot@users.noreply.github.com> --- .../limit-sets/limit-sets-tabular-modification-form.tsx | 1 - .../dialogs/network-modifications/tabular/tabular-form.tsx | 1 - 2 files changed, 2 deletions(-) diff --git a/src/components/dialogs/network-modifications/limit-sets/limit-sets-tabular-modification-form.tsx b/src/components/dialogs/network-modifications/limit-sets/limit-sets-tabular-modification-form.tsx index 8bedfa28ed..6f32039338 100644 --- a/src/components/dialogs/network-modifications/limit-sets/limit-sets-tabular-modification-form.tsx +++ b/src/components/dialogs/network-modifications/limit-sets/limit-sets-tabular-modification-form.tsx @@ -298,7 +298,6 @@ export function LimitSetsTabularModificationForm({ dataFetching }: Readonly> label="UploadCSV" header={csvColumns.map((column) => column.id)} - allowMissingColumns disabled={!equipmentType} language={language} parseConfig={parseConfig} diff --git a/src/components/dialogs/network-modifications/tabular/tabular-form.tsx b/src/components/dialogs/network-modifications/tabular/tabular-form.tsx index f9eba3d27d..427fabfab6 100644 --- a/src/components/dialogs/network-modifications/tabular/tabular-form.tsx +++ b/src/components/dialogs/network-modifications/tabular/tabular-form.tsx @@ -563,7 +563,6 @@ export function TabularForm({ dataFetching, dialogMode }: Readonly> label="UploadCSV" header={csvColumns} - allowMissingColumns disabled={!equipmentType} language={language} parseConfig={parseConfig}