Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/app/donorOffers/[donorOfferId]/finalize/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ export default function FinalizeDonorOfferPage() {
onReset={resetUpload}
/>

{errors && errors.length > 0 && <ErrorDisplay errors={errors} />}
{errors && errors.length > 0 && !fileErrorMessage && <ErrorDisplay errors={errors} />}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 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.


{preview && <PreviewTable final={true} data={previewData} />}

Expand Down
2 changes: 1 addition & 1 deletion src/app/donorOffers/create/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ export default function CreateDonorOfferPage() {
onReset={resetUpload}
/>

{errors && errors.length > 0 && <ErrorDisplay errors={errors} />}
{errors && errors.length > 0 && !fileErrorMessage && <ErrorDisplay errors={errors} />}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 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 only

A 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:

Suggested change
{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.


{preview && <PreviewTable final={false} data={data} />}

Expand Down
2 changes: 1 addition & 1 deletion src/screens/AdminDistributionsScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { useRouter } from "next/navigation";
enum DistributionTab {
DISTRIBUTIONS = "Distributions",
SHIPMENTS = "Shipments",
SIGNOFFS = "Sign-offs"
SIGNOFFS = "Completed Sign-offs"
}

export default function AdminDistributionsScreen() {
Expand Down
Loading