fix(admin_ui): fallback tokens by paanSinghCoder · Pull Request #1408 · raystack/frontier

@paanSinghCoder

Summary

Revert fallback logic

Changes

Technical Details

Test Plan

  • Manual testing completed
  • Build and type checking passes

@paanSinghCoder

@vercel

@coderabbitai

📝 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

rsbh

rsbh approved these changes Feb 23, 2026

coderabbitai[bot]

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 | 🟡 Minor

Duplicate data-test-id on 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 name InviteUsersDialogProps should be AddTokensDialogProps.

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 with z.coerce.number().min(1) in the schema.

The browser allows typing 0 without any visual constraint, but Zod then rejects it — producing a slightly confusing experience. Aligning min={1} on the input prevents the value from even being enterable.

♻️ Proposed fix

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 59f0007 and b1e32e4.

📒 Files selected for processing (1)
  • web/sdk/admin/views/organizations/details/layout/add-tokens-dialog.tsx

@coveralls

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 Coverage Status
Change from base Build 22301950801: 0.0%
Covered Lines: 16200
Relevant Lines: 42125

💛 - Coveralls