fix(admin_ui): fallback tokens by paanSinghCoder · Pull Request #1408 · raystack/frontier
Summary
Revert fallback logic
Changes
Technical Details
Test Plan
- Manual testing completed
- Build and type checking passes
📝 Walkthrough
Summary by CodeRabbit
Bug Fixes
- Fixed the add tokens dialog form initialization to properly apply default product values when the product identifier field is empty or unset.
Walkthrough
Changed the default value initialization logic in the AddTokensDialog form from nullish coalescing operator (??) to logical OR operator (||) for the product field, affecting how empty strings and falsy values trigger fallback to defaults.
Changes
| Cohort / File(s) | Summary |
|---|---|
Form Default Value Logic web/sdk/admin/views/organizations/details/layout/add-tokens-dialog.tsx |
Modified product field default value resolution from nullish coalescing to logical OR operator, changing fallback behavior for falsy values including empty strings. |
Estimated code review effort
🎯 2 (Simple) | ⏱️ ~10 minutes
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 @coderabbitai help to get the list of available commands and usage tips.
rsbh approved these changes Feb 23, 2026
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
web/sdk/admin/views/organizations/details/layout/add-tokens-dialog.tsx (1)
141-154: ⚠️ Potential issue | 🟡 MinorDuplicate
data-test-idon Cancel and Add buttons.Both buttons carry
data-test-id="add-tokens-invite-button", making them indistinguishable in selector-based tests. The Cancel button ID likely should be something like"add-tokens-cancel-button".🐛 Proposed fix
- <Button - data-test-id="add-tokens-invite-button" - type="reset" - color="neutral" - variant="outline" - > + <Button + data-test-id="add-tokens-cancel-button" + type="reset" + color="neutral" + variant="outline" + > Cancel </Button>
🧹 Nitpick comments (2)
web/sdk/admin/views/organizations/details/layout/add-tokens-dialog.tsx (2)
22-24: Interface nameInviteUsersDialogPropsshould beAddTokensDialogProps.Copy-paste remnant; doesn't affect runtime but misleads readers tracing the type.
♻️ Proposed rename
-interface InviteUsersDialogProps { +interface AddTokensDialogProps { onOpenChange: (open: boolean) => void; } // ... -export const AddTokensDialog = ({ onOpenChange }: InviteUsersDialogProps) => { +export const AddTokensDialog = ({ onOpenChange }: AddTokensDialogProps) => {
118-118:min={0}on the input conflicts withz.coerce.number().min(1)in the schema.The browser allows typing
0without any visual constraint, but Zod then rejects it — producing a slightly confusing experience. Aligningmin={1}on the input prevents the value from even being enterable.♻️ Proposed fix
Pull Request Test Coverage Report for Build 22302526511
Details
- 0 of 0 changed or added relevant lines in 0 files are covered.
- No unchanged relevant lines lost coverage.
- Overall coverage remained the same at 38.457%
| Totals | |
|---|---|
| Change from base Build 22301950801: | 0.0% |
| Covered Lines: | 16200 |
| Relevant Lines: | 42125 |
💛 - Coveralls
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