Repository navigation
ezra/325-negating-duplicate-offer-error - #332
Conversation
✅ Deploy Preview for hope-for-haiti ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Greptile SummaryThis PR suppresses the duplicate error display that occurred when a file upload failed — previously both
Confidence Score: 4/5Fix correctly removes duplicate error display but introduces a regression that silently hides multi-error API responses — should be addressed before merging. Two P1 findings: the Both changed files carry the same issue; the root cause lives in Important Files Changed
|
| /> | ||
|
|
||
| {errors && errors.length > 0 && <ErrorDisplay errors={errors} />} | ||
| {errors && errors.length > 0 && !fileErrorMessage && <ErrorDisplay errors={errors} />} |
There was a problem hiding this comment.
Multi-error responses silently truncated
When the API returns multiple validation errors (e.g. several invalid CSV rows), useFileUpload stores them all in errors[] but only puts the first message in fileErrorMessage. Because !fileErrorMessage now suppresses ErrorDisplay, errors 2-N are never shown — FileInfoDisplay only renders fileErrorMessage, which is errorMessages[0].
In useFileUpload.ts lines 85-86:
setErrors(errorMessages); // full list
setFileErrorMessage(errorMessages[0]); // first entry onlyA user uploading a CSV with multiple row-level errors would only ever see the first error and would have to fix and re-upload iteratively rather than fixing everything at once.
Consider showing ErrorDisplay when there are more errors than fileErrorMessage covers:
| {errors && errors.length > 0 && !fileErrorMessage && <ErrorDisplay errors={errors} />} | |
| {errors && errors.length > 0 && (!fileErrorMessage || errors.length > 1) && <ErrorDisplay errors={fileErrorMessage ? errors.slice(1) : errors} />} |
Or alternatively, set fileErrorMessage to a generic summary (e.g. "File contains errors — see details below") so the detailed list is always rendered via ErrorDisplay.
| /> | ||
|
|
||
| {errors && errors.length > 0 && <ErrorDisplay errors={errors} />} | ||
| {errors && errors.length > 0 && !fileErrorMessage && <ErrorDisplay errors={errors} />} |
There was a problem hiding this comment.
Same multi-error truncation issue as
create/page.tsx
The same logic applies here: when the finalize API returns several row-level CSV errors, fileErrorMessage only captures the first, so suppressing ErrorDisplay with !fileErrorMessage hides all subsequent errors from the user. See the comment on create/page.tsx for the full analysis and a suggested remediation.
|
Ignore greptile, multi level errors still function properly. Nice work |
Description
Resolves ticket number: #325
Explain what your code changes: There are two sources where errors are stored within the create/page.tsx and finalize/page.tsx. It is ultimately stored within ErrorDisplay and fileErrorMessage. Because we want to keep the error display(the error at the top), just negated the fileErrorMessage.
On creation:

On finalization:

List the steps you took to test your code: Manually uploading invalid csv files on both creation and finalization
Also changed the "Sign Offs" to "Completed Sign Offs" in a following commit
Checklist