fix(web): show correct validation error in quick add toast (Issue #9329)#9351
fix(web): show correct validation error in quick add toast (Issue #9329)#9351geeked-anshuk666 wants to merge 1 commit into
Conversation
|
Important Review skippedNo new commits to review since the last review. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthrough
ChangesQuick add error handling
Estimated code review effort: 1 (Trivial) | ~5 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
fd7667e to
b27c691
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
apps/web/core/components/issues/issue-layouts/quick-add/root.tsx (1)
129-140: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider extracting this error-parsing logic into a shared utility.
The PR objective calls for matching the sidebar/modal creation flow's error behavior. If that flow already has similar (or more complete) error-parsing logic, duplicating an ad-hoc version here risks future divergence. A shared helper (e.g.,
getFirstValidationError(err)) would also avoid theanycast at Line 133, aligning better with the strict-typing guideline for.ts/.tsxfiles.As per coding guidelines, "TypeScript strict mode enabled; all files must be typed."
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/web/core/components/issues/issue-layouts/quick-add/root.tsx` around lines 129 - 140, The quick-add error message parser in root.tsx duplicates validation-error handling and relies on an any cast. Extract this logic into a shared typed helper (for example, getFirstValidationError(err)) and reuse it here and in the sidebar/modal creation flow so both paths stay consistent. Keep the helper strictly typed for .ts/.tsx files, and have the message callback fall back to err.message or the translated default when no validation message is found.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/web/core/components/issues/issue-layouts/quick-add/root.tsx`:
- Around line 129-140: The error formatter in the quick-add root message handler
only extracts messages from array-shaped payloads, so string or nested
first-error values still collapse to the generic fallback. Update the message
callback in the quick-add flow to handle additional payload shapes, including
direct string values and nested objects with a usable first message, while
keeping the existing array handling in place. Use the existing message callback
in root.tsx and the t("common.error.message") fallback as the reference points.
---
Nitpick comments:
In `@apps/web/core/components/issues/issue-layouts/quick-add/root.tsx`:
- Around line 129-140: The quick-add error message parser in root.tsx duplicates
validation-error handling and relies on an any cast. Extract this logic into a
shared typed helper (for example, getFirstValidationError(err)) and reuse it
here and in the sidebar/modal creation flow so both paths stay consistent. Keep
the helper strictly typed for .ts/.tsx files, and have the message callback fall
back to err.message or the translated default when no validation message is
found.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 1debcfba-8df7-4e18-b2fd-17ae65079197
📒 Files selected for processing (1)
apps/web/core/components/issues/issue-layouts/quick-add/root.tsx
b27c691 to
abd53fa
Compare
|
@coderabbitai review |
✅ Action performedReview finished.
|
Description
When submitting a work item/issue using the inline quick-add input with an invalid title (e.g., exceeding 255 characters), the error toast displays a generic fallback message:
"Some error occurred. Please try again."instead of the actual validation error returned by the Django backend.Root cause: Django returns field-specific validation errors as a nested dictionary (e.g.,
{"name": ["Ensure this field has no more than 255 characters."]}). The quick-add error handler was directly reading error values as single strings or string arrays, failing to parse dictionary values and falling back to the generic message.Fix: Updated the validation error helper in
apps/web/core/components/issues/issue-layouts/quick-add/root.tsxto check if the error is a dictionary. If it is, it parses the keys usingObject.keys()and extracts the first error message dynamically, displaying it in the toast.Type of Change
Screenshots and Media (if applicable)
Before:
An error toast popped up saying:
"Some error occurred. Please try again."After:

Detailed validation error message showing
"Ensure this field has no more than 255 characters."in the toast notification instead of the generic error fallback.Test Scenarios
+ New work itemunder any group to open the inline quick-add input."Some error occurred. Please try again.""Ensure this field has no more than 255 characters."References
Fixes #9329
Summary by CodeRabbit
messagefield.