Skip to content

fix: replace alert() with toast.error() for avatar upload validation (Closes #879) [fj4WqyCCw3C5ShR1RfB7MoBPTpkRrBFYP1uT35g3MvT] - #948

Open
waterWang wants to merge 1 commit into
Grainlify:mainfrom
waterWang:fix/profiletab-avatar-upload-alert
Open

fix: replace alert() with toast.error() for avatar upload validation (Closes #879) [fj4WqyCCw3C5ShR1RfB7MoBPTpkRrBFYP1uT35g3MvT]#948
waterWang wants to merge 1 commit into
Grainlify:mainfrom
waterWang:fix/profiletab-avatar-upload-alert

Conversation

@waterWang

Copy link
Copy Markdown
Contributor

Summary

Replaces the native alert() calls in ProfileTab.handleFileUpload with toast.error() from the sonner toast system, matching the pattern used everywhere else in this file. Also resets e.target.value after each validation failure so the same file can be re-selected.

Changes

  • ProfileTab.tsx: Replace both alert(...) calls with toast.error(...) using the same messages
  • ProfileTab.tsx: Reset e.target.value = '' after each validation failure so re-selecting the same file re-triggers onChange
  • ProfileTab.test.tsx: Add 3 tests covering:
    • Invalid file type triggers toast.error with the correct message
    • Oversized file triggers toast.error with the correct message
    • Re-selecting the same rejected file re-runs validation (input value reset)

Closes #879

…loses Grainlify#879) [fj4WqyCCw3C5ShR1RfB7MoBPTpkRrBFYP1uT35g3MvT]
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.

ProfileTab avatar upload validation uses native alert() instead of the app's toast system

1 participant