Skip to content

fix(#3602): FileUploadInput error state to match FileUploadCard#3842

Closed
willcodeforcoffee wants to merge 1 commit intodevfrom
eric/file-upload-input-error-card
Closed

fix(#3602): FileUploadInput error state to match FileUploadCard#3842
willcodeforcoffee wants to merge 1 commit intodevfrom
eric/file-upload-input-error-card

Conversation

@willcodeforcoffee
Copy link
Copy Markdown
Collaborator

@willcodeforcoffee willcodeforcoffee commented Apr 17, 2026

Before (the change)

image

File upload errors were listed in a unique state, which could cause them to not be visible when used in conjunction with the FileUploadCards.

After (the change)

File upload errors are listed in the same format as FileUploadCard.

image

Make sure that you've checked the boxes below before you submit the PR

  • I have read and followed the setup steps
  • I have created necessary unit tests
  • I have tested the functionality in both React and Angular.

Steps needed to test

@willcodeforcoffee willcodeforcoffee self-assigned this Apr 17, 2026
@willcodeforcoffee willcodeforcoffee added File uploader P2 Priority 2 (should have): Improves completeness and reduces the post-launch support load. labels Apr 17, 2026
@netlify

This comment was marked as outdated.

@willcodeforcoffee willcodeforcoffee force-pushed the eric/file-upload-input-error-card branch 3 times, most recently from c881917 to 6490d79 Compare April 22, 2026 21:25
@willcodeforcoffee willcodeforcoffee marked this pull request as ready for review April 23, 2026 16:38
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the goa-file-upload-input web component to present validation errors using the same goa-file-upload-card UI as FileUploadCard, and adds Angular/React PR demo routes for bug #3602.

Changes:

  • Render FileUploadInput validation issues as goa-file-upload-card instances (including size/type metadata).
  • Update FileUploadInput unit tests to assert the new issue rendering format.
  • Add PR demo routes/pages for Angular and React to reproduce/verify bug #3602.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
libs/web-components/src/components/file-upload-input/FileUploadInput.svelte Switches issue rendering to goa-file-upload-card and adds delete-to-dismiss behavior.
libs/web-components/src/components/file-upload-input/file-upload-input.spec.ts Updates tests to look for the new issue card test ids.
apps/prs/react/src/routes/bugs/bug3602.tsx Adds a React demo page showcasing FileUploadInput + FileUploadCard together.
apps/prs/react/src/app/routes/bugs/bug3602.route.ts Registers the React demo route.
apps/prs/angular/src/routes/bugs/3602/bug3602.route.json Registers the Angular demo route metadata.
apps/prs/angular/src/routes/bugs/3602/bug3602.component.ts Adds an Angular demo component for the scenario.
apps/prs/angular/src/routes/bugs/3602/bug3602.component.html Adds the Angular demo template displaying uploaded cards.

Comment thread libs/web-components/src/components/file-upload-input/file-upload-input.spec.ts Outdated
Comment thread libs/web-components/src/components/file-upload-input/FileUploadInput.svelte Outdated
Comment thread libs/web-components/src/components/file-upload-input/FileUploadInput.svelte Outdated
Comment thread apps/prs/react/src/routes/bugs/bug3602.tsx
Comment thread apps/prs/react/src/routes/bugs/bug3602.tsx Outdated
Comment thread apps/prs/react/src/routes/bugs/bug3602.tsx Outdated
Comment thread apps/prs/angular/src/routes/bugs/3602/bug3602.component.ts Outdated
@willcodeforcoffee
Copy link
Copy Markdown
Collaborator Author

@copilot apply changes based on the comments in this thread

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 23, 2026

@copilot apply changes based on the comments in this thread

Applied all changes from the review thread in commit 8b50b90:

  • FileUploadInput.svelte: Added (issue) key to the {#each} block, changed filter to use object identity (currentIssue !== issue), and added an update hook to dismissOnDelete so the listener is rebound when the closure changes.
  • file-upload-input.spec.ts: Added a test that fires the _delete event on an issue card and asserts the element is removed.
  • bug3602.tsx (React): Imported Dispatch/SetStateAction directly from "react" (removing React.* namespace usage), fixed the escaped template literal (\${Date.now()}${Date.now()}), removed handleDelete and instead close over f.id in each card's onDelete handler.
  • bug3602.component.ts (Angular): Replaced filter with a removeFirstMatchingFile helper using findIndex so only the first matching filename is removed.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 27, 2026

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://GovAlta.github.io/ui-components/pr-preview-angular/pr-3842/

Built to branch gh-pages at 2026-04-30 19:50 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 27, 2026

Preview links

Target URL
Docs https://govalta.github.io/ui-components/pr-preview/pr-3842/
React playground https://govalta.github.io/ui-components/pr-preview-react/pr-3842/
Angular playground https://govalta.github.io/ui-components/pr-preview-angular/pr-3842/

Built from commit aeaba12. Previews are removed automatically when this PR closes.

Comment thread libs/web-components/src/components/file-upload-input/FileUploadInput.svelte Outdated
@willcodeforcoffee willcodeforcoffee force-pushed the eric/file-upload-input-error-card branch from 7d63a4d to e4bfd74 Compare April 27, 2026 21:54
Copy link
Copy Markdown
Collaborator

@vanessatran-ddi vanessatran-ddi left a comment

Choose a reason for hiding this comment

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

Looks good!

Copy link
Copy Markdown
Collaborator

@bdfranck bdfranck left a comment

Choose a reason for hiding this comment

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

I looked at the changes...

  • ✅ When I attempt to upload a file that exceeds the limits, I see the error on the file card.
  • ✅ I don't see the error message below the drag-and-drop upload input.
  • ✅ The error message aligns with our "File too large" error message content guidelines.
Image

Looks good to me! 👍

@willcodeforcoffee
Copy link
Copy Markdown
Collaborator Author

@ArakTaiRoth ready for merge when you are! 🙏

@ArakTaiRoth
Copy link
Copy Markdown
Collaborator

@Spark450 In the story attached to this PR, you have "The FileUploadCard component is documented as a "subcomponent" and is not surfaced for users that may want to use it independently from the uploader. There should be examples that show both uploader and uploader cards."

I just want to check about this, as this requirement doesn't make sense to me. Reading this implies to me that we have File Upload Card as a completely separate component from File Upload Input and documented as such. That doesn't make sense to me because Card is only meant to be used with Input, and is not intended to be used independently. As this isn't included in the Acceptance Criteria, I just want to make sure that this is a mistake and not intended to be taken this way?

files: UploadedFile[],
detail: GoabFileUploadOnDeleteDetail,
): UploadedFile[] {
const index = files.findIndex((f) => f.filename === detail.filename);
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.

Here you're deleting files based off of filename while they're tracked in the html file by id. If 2 files have the same filename (which would work because tracked by id), deleting the second item will remove the first matching item instead of the one selected.

This doesn't happen in the React playground, because it deletes via id and tracks via id.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@ArakTaiRoth Good point. It is just for the PR code, but I updated it.

@willcodeforcoffee
Copy link
Copy Markdown
Collaborator Author

@Spark450 In the story attached to this PR, you have "The FileUploadCard component is documented as a "subcomponent" and is not surfaced for users that may want to use it independently from the uploader. There should be examples that show both uploader and uploader cards."

I just want to check about this, as this requirement doesn't make sense to me. Reading this implies to me that we have File Upload Card as a completely separate component from File Upload Input and documented as such. That doesn't make sense to me because Card is only meant to be used with Input, and is not intended to be used independently. As this isn't included in the Acceptance Criteria, I just want to make sure that this is a mistake and not intended to be taken this way?

Mark and I had discussed this. I was planning to do the documentation updates in a separate PR. That said, Vanessa just did a huge PR with a ton of documentation updates, including stuff for FileUploadInput and FileUploadCard and now I'm not sure its even necessary.

…d format

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

Co-authored-by: willcodeforcoffee <3766866+willcodeforcoffee@users.noreply.github.com>
@willcodeforcoffee willcodeforcoffee force-pushed the eric/file-upload-input-error-card branch from e4bfd74 to aeaba12 Compare April 30, 2026 19:47
@Spark450
Copy link
Copy Markdown
Collaborator

Spark450 commented May 1, 2026

@Spark450 In the story attached to this PR, you have "The FileUploadCard component is documented as a "subcomponent" and is not surfaced for users that may want to use it independently from the uploader. There should be examples that show both uploader and uploader cards."

I just want to check about this, as this requirement doesn't make sense to me. Reading this implies to me that we have File Upload Card as a completely separate component from File Upload Input and documented as such. That doesn't make sense to me because Card is only meant to be used with Input, and is not intended to be used independently. As this isn't included in the Acceptance Criteria, I just want to make sure that this is a mistake and not intended to be taken this way?

@ArakTaiRoth There has been a use case surfaced to me a few times where a team would want to use the upload card without the uploader. For example a worker could be reviewing a submission that includes uploaded files. Designers have expressed interest in showing those uploaded file (cards) on the page of that submission. I think its likely that they would need a this new feature to round out what they would want to do though.

@ArakTaiRoth ArakTaiRoth deleted the branch dev May 5, 2026 18:28
@ArakTaiRoth ArakTaiRoth closed this May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

File uploader P2 Priority 2 (should have): Improves completeness and reduces the post-launch support load.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document FileUploadCard and fix invalid file upload card state

7 participants