Skip to content

Show file-upload validation error in modal instead of inline 'Invalid Input' - #785

Open
akash-m-2001 wants to merge 1 commit into
mainfrom
fix/699/better-rules-engine-errors
Open

akash-m-2001 wants to merge 1 commit into
mainfrom
fix/699/better-rules-engine-errors

Conversation

@akash-m-2001

@akash-m-2001 akash-m-2001 commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

When a user clicks Calculate on the new-case page without choosing an energy-use file, conform's client-side validation fails and printed a raw `Invalid input` next to the file picker — meaningless to a homeowner.

This replaces that inline text with the existing `ErrorModal` and homeowner-readable copy telling them to download a CSV from their utility and upload it. The modal clears automatically once a valid file is selected (conform revalidates on input).

  • Client-side only, because conform blocks the submit before it reaches the action.
  • Edit mode is unaffected (`!isEditMode` guard).
  • The server-side modal for bad CSV content (wrong format, malformed dates) is unchanged.

Part of #699.

Test plan

  • `/cases/new`, fill the form, don't choose a file, click Calculate → friendly modal, no red inline text
  • Choose a valid CSV → modal closes, calculation proceeds
  • Upload a malformed CSV → server-side modal still works
  • `npm run typecheck` passes
  • `SingleCaseForm.test.tsx`: same pass/fail as main (pre-existing jsdom failures unrelated)

@EkaterinaKladova EkaterinaKladova left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Front end works, error shows up the first time Calculate button is clicked without a file uploaded. Looks good!

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