fix: validate quick-add title length and surface field errors#9416
Open
pranav-afk wants to merge 1 commit into
Open
fix: validate quick-add title length and surface field errors#9416pranav-afk wants to merge 1 commit into
pranav-afk wants to merge 1 commit into
Conversation
Inline work item creation showed a generic toast when the title exceeded 255 characters, while the modal path already validated with a clear message. Add maxLength validation across quick-add layouts, extract API field errors in the toast, and roll back optimistic temp issues on failure. Fixes makeplane#9329
Contributor
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughQuick-add issue forms now enforce a localized 255-character title limit. Failed optimistic creation rolls back temporary issue state, while the quick-add root extracts structured errors and displays title validation messages inline. ChangesQuick-add error flow
Estimated code review effort: 3 (Moderate) | ~20 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Aligns inline (quick-add) work item creation with the modal path when the title is longer than 255 characters.
Previously, list/kanban/gantt/calendar/spreadsheet quick-add only required a title. Submitting 256+ characters hit the API with a 400 ({ name: [...] }), and the toast fell back to a generic “Some error occurred. Please try again.” because the issue service throws response.data (field errors), not an Error with message. The modal already used maxLength: 255 with title_should_be_less_than_255_characters.
Changes:
• Add maxLength: 255 validation on quick-add title inputs across list, kanban, gantt, calendar, and spreadsheet layouts
• Show the validation message under the quick-add form when the title is too long
• Improve toast error extraction so API field errors (e.g. name: ["…"]) are shown instead of a generic message
• On failed quick-add, roll back the optimistic temporary issue so a failed create does not stay in the list
Type of Change
• [x] Bug fix (non-breaking change which fixes an issue)
• [ ] Feature (non-breaking change which adds functionality)
• [ ] Improvement (change that would cause existing functionality to not work as expected)
• [ ] Code refactoring
• [ ] Performance improvements
• [ ] Documentation update
Screenshots and Media (if applicable)
Test Scenarios
• Open Work Items list view → inline + New work item
• Paste a title longer than 255 characters → press Enter
• Expect: no API call; clear “Title should be less than 255 characters” (or equivalent i18n) under the field
• Expect: not the generic error toast
• Submit a title of exactly 255 characters → work item creates successfully
• Repeat on board / spreadsheet / gantt / calendar quick-add if available
• Compare with the sidebar/modal create form: same max-length behavior
• Force a server-side field error (if possible): toast should show the field message, not only “Some error occurred”
• On a failed create, confirm the temporary optimistic row is removed from the list
References
• Fixes #9329
Summary by CodeRabbit