Skip to content

Clear file state on equipment type change in tabular forms#4070

Open
flomillot wants to merge 2 commits into
mainfrom
florent/reset-file-state-on-type-change
Open

Clear file state on equipment type change in tabular forms#4070
flomillot wants to merge 2 commits into
mainfrom
florent/reset-file-state-on-type-change

Conversation

@flomillot

Copy link
Copy Markdown
Contributor

Summary

In the tabular and limit-sets modification forms, the file/import state (selected file, file error/warning, CSV filename) was reset only through resetOnConfirmation, which runs only when the confirmation popup opens — i.e. when the table is non-empty. Changing the equipment type on an empty table skipped the popup, leaving a stale selected file or file message from the previous type.

The reset is now split:

  • resetOnConfirmation — the destructive table/properties reset stays gated behind confirmation.
  • resetOnChange — the file state is cleared on every type change.

Dependency

Relies on the new resetOnChange prop of InputWithPopupConfirmation: gridsuite/commons-ui#1216. Requires that change to be released before this one is functional.

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 <noreply@anthropic.com>
Signed-off-by: Florent MILLOT <75525996+flomillot@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 048a950f-4a18-4682-b507-1afeb97a9afd

📥 Commits

Reviewing files that changed from the base of the PR and between 5b7e66d and 076576f.

📒 Files selected for processing (2)
  • src/components/dialogs/network-modifications/limit-sets/limit-sets-tabular-modification-form.tsx
  • src/components/dialogs/network-modifications/tabular/tabular-form.tsx

📝 Walkthrough

Walkthrough

Both TabularForm and LimitSetsTabularModificationForm replace a single handleChangeType reset callback with two separate callbacks: one clears only file/CSV-related state on type change, and another clears form/table state on confirmation. InputWithPopupConfirmation is rewired to use resetOnChange and resetOnConfirmation accordingly.

Split type-change reset callbacks

Layer / File(s) Summary
tabular-form split reset
src/components/dialogs/network-modifications/tabular/tabular-form.tsx
Adds resetFileStateOnTypeChange to clear CSV filename, selected file, and file error messages; refactors the confirmation callback to clear only form/table state and TABULAR_PROPERTIES; wires both to InputWithPopupConfirmation.
limit-sets form split reset
src/components/dialogs/network-modifications/limit-sets/limit-sets-tabular-modification-form.tsx
Replaces single handleChangeType with resetFileStateOnTypeChange and resetFormStateOnTypeChange; updates InputWithPopupConfirmation props to use the two callbacks.

Suggested Reviewers

  • ghazwarhili
  • basseche
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: clearing file state when equipment type changes in tabular forms.
Description check ✅ Passed The description accurately describes the split between change-time file resets and confirmation-gated table resets.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed: one or more packages not found in the registry.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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>
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant