Conversation
|
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
📝 WalkthroughWalkthroughThis pull request introduces modifications to key management components in the dashboard application, specifically focusing on refill settings for API keys. The changes primarily affect two files: Changes
Possibly related PRs
Suggested labels
Suggested reviewers
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (6)
✅ Files skipped from review due to trivial changes (4)
🚧 Files skipped from review as they are similar to previous changes (2)
⏰ Context from checks skipped due to timeout of 90000ms (12)
Finishing Touches
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 (
|
|
Thank you for following the naming conventions for pull request titles! 🙏 |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (3)
apps/dashboard/app/(app)/apis/[apiId]/keys/[keyAuthId]/[keyId]/settings/update-key-remaining.tsx (3)
79-79: Consider simplifying the interval initialization logic.The current initialization can be simplified using a more straightforward approach.
- interval: apiKey.refillDay ? "monthly" : apiKey.refillAmount ? "daily" : "none", + interval: apiKey.refillDay + ? "monthly" + : apiKey.refillAmount + ? "daily" + : "none",Also applies to: 82-82
107-109: Consider adding additional validation for refill settings.While the current validation is good, consider adding these checks:
- Validate that refill amount is less than or equal to the remaining amount
- Validate that monthly refill day is within the valid range (1-28) to handle all months consistently
+ if (values.refill?.amount && values.remaining && values.refill.amount > values.remaining) { + form.setError("refill.amount", { + message: "Refill amount cannot be greater than remaining uses", + }); + return; + } + + if (values.refill?.interval === "monthly" && values.refill?.refillDay) { + if (values.refill.refillDay > 28) { + form.setError("refill.refillDay", { + message: "Please select a day between 1-28 to ensure consistent monthly refills", + }); + return; + } + }Also applies to: 111-116, 125-127
206-207: Consider simplifying the disabled conditions.The disabled conditions could be more concise while maintaining readability.
- !form.watch("limitEnabled") === true || - form.watch("refill.interval") === "none" + !form.watch("limitEnabled") || form.watch("refill.interval") === "none"Also applies to: 234-236, 244-244, 248-253
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
apps/dashboard/app/(app)/apis/[apiId]/keys/[keyAuthId]/[keyId]/settings/update-key-remaining.tsx(6 hunks)apps/dashboard/app/(app)/apis/[apiId]/keys/[keyAuthId]/new/client.tsx(3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (17)
- GitHub Check: Test Packages / Test ./packages/rbac
- GitHub Check: Test Packages / Test ./packages/nextjs
- GitHub Check: Test Packages / Test ./packages/hono
- GitHub Check: Test Packages / Test ./packages/cache
- GitHub Check: Test Packages / Test ./packages/api
- GitHub Check: Test Packages / Test ./internal/clickhouse
- GitHub Check: Test Packages / Test ./internal/resend
- GitHub Check: Test Packages / Test ./internal/keys
- GitHub Check: Test Packages / Test ./internal/id
- GitHub Check: Test Packages / Test ./internal/hash
- GitHub Check: Test Packages / Test ./internal/encryption
- GitHub Check: Test Packages / Test ./internal/billing
- GitHub Check: Build / Build
- GitHub Check: Test Agent Local / test_agent_local
- GitHub Check: Test API / API Test Local
- GitHub Check: autofix
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (4)
apps/dashboard/app/(app)/apis/[apiId]/keys/[keyAuthId]/[keyId]/settings/update-key-remaining.tsx (3)
23-29: LGTM!The select components are correctly imported from the UI library.
46-46: LGTM!The schema changes are well-structured:
- The interval field correctly uses an enum type with appropriate values
- The amount field validation is properly chained
Also applies to: 50-51
176-200: LGTM!The refill interval form field is well-implemented with:
- Proper disabled conditions
- Clear labeling and descriptions
- Appropriate use of UI components
apps/dashboard/app/(app)/apis/[apiId]/keys/[keyAuthId]/new/client.tsx (1)
510-510: LGTM!The default value handling for refill interval is consistent with the update form implementation.
…ning-forces-you-to-choose
…-you-to-choose' of https://github.com/unkeyed/unkey into eng-1598-creating-a-key-in-the-ui-with-remaining-forces-you-to-choose
…-creating-a-key-in-the-ui-with-remaining-forces-you-to-choose
…ning-forces-you-to-choose

What does this PR do?
Fixes # (issue)
If there is not an issue for this, please create one first. This is used to tracking purposes and also helps use understand why this PR exists
Type of change
How should this be tested?
Verify creating and updating keys work as expected.
Checklist
Required
pnpm buildpnpm fmtconsole.logsgit pull origin mainAppreciated
Summary by CodeRabbit
New Features
Bug Fixes