Skip to content

fix(frontend): prevent invalid file uploads from triggering API calls#235

Open
sanchit955 wants to merge 1 commit intoc2siorg:mainfrom
sanchit955:fix-file-upload-validation
Open

fix(frontend): prevent invalid file uploads from triggering API calls#235
sanchit955 wants to merge 1 commit intoc2siorg:mainfrom
sanchit955:fix-file-upload-validation

Conversation

@sanchit955
Copy link
Copy Markdown

Fix: Prevent unnecessary API calls for invalid file uploads

Previously, selecting an unsupported or invalid file still triggered an API request to /projects/upload, which resulted in a backend 400 error. This caused unnecessary network calls and a poor user experience.

Changes

  • Added client-side file validation (extension + empty file check)
  • Prevents API calls for invalid files
  • Displays errors using toast notifications instead of relying on backend responses
  • Added accept attribute to file input for better UX
  • Added defensive validation before form submission

Supported formats

.csv, .xlsx, .json, .parquet, .tsv

Impact

  • Improves UX by validating inputs early
  • Reduces unnecessary backend load
  • Keeps implementation minimal and consistent with existing codebase
  • Aligns frontend behavior with supported dataset formats

@sanchit955 sanchit955 force-pushed the fix-file-upload-validation branch from f505da4 to cb3371f Compare March 27, 2026 21:25
@sanchit955 sanchit955 force-pushed the fix-file-upload-validation branch from a01298b to 20a2259 Compare March 27, 2026 21:30
@sanchit955
Copy link
Copy Markdown
Author

Hi maintainers, I’ve squashed the commits into a single commit and all checks are now passing. Would love your review 🙌

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