Skip to content

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

Open
flomillot wants to merge 6 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 6 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: 01876b17-6ecf-4e76-84a8-4b27720aab07

📥 Commits

Reviewing files that changed from the base of the PR and between 076576f and 2d1c260.

📒 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
🚧 Files skipped from review as they are similar to previous changes (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 tabular form components split a combined type-change reset into separate file-state and form/table-state callbacks, then wire them to resetOnChange and resetOnConfirmation on InputWithPopupConfirmation.

Changes

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: basseche, ghazwarhili

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: clearing file state when equipment type changes in tabular forms.
Description check ✅ Passed The description matches the implemented split between change-time file-state reset and confirmation-gated table reset.
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

Tools execution failed with the following error:

Failed to run tools: 13 INTERNAL: Received RST_STREAM with code 2 (Internal server error)


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.

flomillot and others added 3 commits June 29, 2026 20:01
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>
@basseche basseche self-requested a review July 8, 2026 15:46
@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.

2 participants