-
Notifications
You must be signed in to change notification settings - Fork 502
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(dashboard): update feedback message for minimum length requirement #2281
Conversation
Update Zod schema to specify that feedback must contain at least 20 characters.
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
📝 WalkthroughWalkthroughThe changes in this pull request involve updating the validation schema for the Changes
Assessment against linked issues
Possibly related PRs
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
@unrenamed is attempting to deploy a commit to the Unkey Team on Vercel. A member of the Team first needs to authorize it. |
Thank you for following the naming conventions for pull request titles! 🙏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (2)
apps/dashboard/lib/trpc/routers/plain.ts (1)
15-17
: Approved: Validation enhancement implemented correctlyThe change successfully implements the required validation for the feedback message, addressing issue #2256. The minimum length requirement of 20 characters ensures that users provide sufficiently detailed feedback, which aligns with the PR objectives.
For future consideration:
Consider extracting the error message to a separate constant or configuration file. This would facilitate easier localization and maintenance of error messages across the application.Example:
const ERROR_MESSAGES = { FEEDBACK_MIN_LENGTH: 'Feedback must contain at least 20 characters', }; // Then in the schema: message: z .string() .min(20, ERROR_MESSAGES.FEEDBACK_MIN_LENGTH),apps/dashboard/components/dashboard/feedback-component.tsx (1)
51-51
: Approved with suggestions for improvementThe change successfully implements the minimum length requirement for the feedback message, addressing the issue raised in #2256. The error message is clear and informative, which improves the user experience during validation.
To further enhance the code:
- Consider extracting the minimum length as a constant for better maintainability:
const MIN_FEEDBACK_LENGTH = 20; // Then in the schema: message: z.string().min(MIN_FEEDBACK_LENGTH, `Feedback must contain at least ${MIN_FEEDBACK_LENGTH} characters`),
- You might want to add a maximum length constraint to prevent excessively long messages:
const MAX_FEEDBACK_LENGTH = 1000; // Adjust as needed message: z.string() .min(MIN_FEEDBACK_LENGTH, `Feedback must contain at least ${MIN_FEEDBACK_LENGTH} characters`) .max(MAX_FEEDBACK_LENGTH, `Feedback must not exceed ${MAX_FEEDBACK_LENGTH} characters`),These suggestions will make the code more maintainable and provide a better user experience by setting clear boundaries for the feedback length.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (2)
- apps/dashboard/components/dashboard/feedback-component.tsx (1 hunks)
- apps/dashboard/lib/trpc/routers/plain.ts (1 hunks)
🧰 Additional context used
🔇 Additional comments (1)
apps/dashboard/components/dashboard/feedback-component.tsx (1)
Line range hint
1-190
: Verify form submission handlingThe schema change looks good, but let's ensure that the form submission handling in the component correctly uses this updated schema.
Please run the following script to check the form submission logic:
This will help us confirm that the form submission logic correctly uses the updated schema, ensuring that the minimum length requirement is enforced when the user submits the form.
✅ Verification successful
[/run_scripts]
Verified: Form submission handling correctly implements the updated schema.
All form submissions in
feedback-component.tsx
utilize the updated schema with the minimum length requirement for the message field. The integration withzodResolver
ensures that validations are enforced as intended.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify form submission handling # Test: Check if the form submission logic uses the updated schema rg --type typescript 'form\.handleSubmit' apps/dashboard/components/dashboard/feedback-component.tsx -A 10Length of output: 143
Script:
#!/bin/bash # Description: Verify form submission handling with corrected file type search # Test: Check if the form submission logic uses the updated schema by searching .ts and .tsx files rg 'form\.handleSubmit' --glob '*.ts' --glob '*.tsx' apps/dashboard/components/dashboard/feedback-component.tsx -A 10Length of output: 452
Awarding unrenamed: 150 points 🕹️ Well done! Check out your new contribution on oss.gg/unrenamed |
What does this PR do?
Fixes Plain SDK validation error by rejecting empty feedback messages. Updates Zod schema to specify that feedback must contain at least 20 characters.
Fixes #2256
Type of change
How should this be tested?
Feedback must contain at least 20 characters
Checklist
Required
pnpm build
pnpm fmt
console.logs
git pull origin main
Appreciated
Summary by CodeRabbit
New Features
Bug Fixes