Skip to content

feat(data-grid): show file validation toasts - #1029

Merged
sadmann7 merged 2 commits into
mainfrom
show-toast
Nov 20, 2025
Merged

sadmann7 merged 2 commits into
mainfrom
show-toast

Conversation

@sadmann7

Copy link
Copy Markdown
Owner

No description provided.

- Show toast when files are rejected during drop
- Display validation reason as main message
- Show truncated filename in description
- Handle multiple file rejections with count
- Keep messages concise following DiceUI pattern
- Remove redundant error message below dropzone (toast is sufficient)
- Clear error state when opening editor
- Auto-clear invalid state after 2s timeout
- Maintain visual red border feedback that fades
Copilot AI review requested due to automatic review settings November 20, 2025 12:10
@vercel

vercel Bot commented Nov 20, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Updated (UTC)
shadcn-table Ready Ready Preview Nov 20, 2025 0:10am

@sadmann7
sadmann7 merged commit 44986dc into main Nov 20, 2025
11 checks passed
@sadmann7
sadmann7 deleted the show-toast branch November 20, 2025 12:11

Copilot AI left a comment

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.

Pull Request Overview

This PR enhances the file upload validation UX in the data grid by replacing inline error messages with toast notifications. The changes improve user feedback by showing toast notifications when files are rejected due to validation failures (file type, size, or quantity limits), while removing the previously inline error display component.

Key Changes:

  • Implemented toast notifications for file validation errors with contextual descriptions showing rejected file names
  • Refactored error tracking from single error string to array of rejected files with reasons
  • Removed inline error display component in favor of toast-based notifications

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

setError(`Maximum ${maxFiles} files allowed`);
const errorMessage = `Maximum ${maxFiles} files allowed`;
setError(errorMessage);
toast(errorMessage);

Copilot AI Nov 20, 2025

Copy link

Choose a reason for hiding this comment

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

[nitpick] Inconsistent error notification: When max files limit is exceeded, only a toast is shown (line 1383), but for file validation errors, both a toast with description is shown (lines 1422-1429). Consider adding a description to the max files toast for consistency, such as { description: "Please remove some files before adding more" } to provide users with actionable guidance.

Suggested change
toast(errorMessage);
toast(errorMessage, {
description: "Please remove some files before adding more",
});

Copilot uses AI. Check for mistakes.
});
if (!isAccepted) {
return `File type not accepted. Accepted: ${accept}`;
return "File type not accepted";

Copilot AI Nov 20, 2025

Copy link

Choose a reason for hiding this comment

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

Usability regression: Removing the accepted file types from the error message (Accepted: ${accept}) means users no longer see which file types are accepted when their upload is rejected. Consider adding this information back to the toast notification, perhaps in the description field, or display accepted file types in the dropzone UI (lines 1758-1764) alongside the max size and max files information.

Suggested change
return "File type not accepted";
return `File type not accepted. Accepted: ${acceptedTypes.join(", ")}`;

Copilot uses AI. Check for mistakes.
Comment on lines +1431 to +1433
setTimeout(() => {
setError(null);
}, 2000);

Copilot AI Nov 20, 2025

Copy link

Choose a reason for hiding this comment

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

Accessibility concern: The error state is used for aria-invalid (line 1736), but it's automatically cleared after 2 seconds via setTimeout. This means screen readers and assistive technologies will lose the invalid state even though the user hasn't corrected the issue. Consider either not auto-clearing the error state, or only clearing it when the user takes a corrective action (e.g., removing files, closing the dialog).

Suggested change
setTimeout(() => {
setError(null);
}, 2000);

Copilot uses AI. Check for mistakes.
Comment on lines +1384 to +1386
setTimeout(() => {
setError(null);
}, 2000);

Copilot AI Nov 20, 2025

Copy link

Choose a reason for hiding this comment

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

Potential memory leak: The setTimeout is not cleaned up if the component unmounts before the timeout fires. Store the timeout ID and clean it up in a useEffect cleanup function to prevent setting state on an unmounted component.

Copilot uses AI. Check for mistakes.
Comment on lines +1431 to +1433
setTimeout(() => {
setError(null);
}, 2000);

Copilot AI Nov 20, 2025

Copy link

Choose a reason for hiding this comment

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

Potential memory leak: The setTimeout is not cleaned up if the component unmounts before the timeout fires. Store the timeout ID and clean it up in a useEffect cleanup function to prevent setting state on an unmounted component.

Copilot uses AI. Check for mistakes.
noodleman1991 pushed a commit to noodleman1991/tablecn that referenced this pull request Mar 12, 2026
* feat: add toast notifications for file drop rejections

- Show toast when files are rejected during drop
- Display validation reason as main message
- Show truncated filename in description
- Handle multiple file rejections with count
- Keep messages concise following DiceUI pattern

* refine file drop rejection feedback

- Remove redundant error message below dropzone (toast is sufficient)
- Clear error state when opening editor
- Auto-clear invalid state after 2s timeout
- Maintain visual red border feedback that fades
@sadmann7
sadmann7 removed the request for review from Copilot March 23, 2026 20:11
anhdd-kuro pushed a commit to anhdd-kuro/tablecn that referenced this pull request Apr 8, 2026
* feat: add toast notifications for file drop rejections

- Show toast when files are rejected during drop
- Display validation reason as main message
- Show truncated filename in description
- Handle multiple file rejections with count
- Keep messages concise following DiceUI pattern

* refine file drop rejection feedback

- Remove redundant error message below dropzone (toast is sufficient)
- Clear error state when opening editor
- Auto-clear invalid state after 2s timeout
- Maintain visual red border feedback that fades

This branch was successfully deployed

2 active deployments
Preview – tablecn — 3366f193 Deployed Nov 20, 2025 by vercel[bot]
Preview – shadcn-table — 3366f193 Deployed Nov 20, 2025 by vercel[bot]
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