Skip to content

Comments

feat: move sdk general#1414

Open
rohanchkrabrty wants to merge 1 commit intomainfrom
move-sdk-general
Open

feat: move sdk general#1414
rohanchkrabrty wants to merge 1 commit intomainfrom
move-sdk-general

Conversation

@rohanchkrabrty
Copy link
Contributor

Summary

Decouple the General page components from TanStack Router, making them standalone and exportable. This is the first step in migrating organization page components to a router-agnostic architecture.

Changes

  • Created standalone view components in react/views/general/:
    • general-page.tsx — Self-contained GeneralPage with state-based delete dialog (replaces route-based modal)
    • general-organization.tsx — Organization settings form, moved from components/organization/general/general.workspace.tsx
    • delete-organization-dialog.tsx — Prop-controlled DeleteOrganizationDialog (open/onClose) replacing the route-mounted version
    • general.module.css — Styles co-located with view components
    • index.ts — Barrel export
  • Added shared types in components/organization/shared/types.ts (OnNavigate, BasePageProps)
  • Reduced components/organization/general/index.tsx to a thin wrapper importing GeneralPage from views
  • Removed deleteOrgRoute child route from routes.tsx
  • Deleted general/delete.tsx and general/general.workspace.tsx (no longer needed)

Technical Details

  • Delete modal converted from route-based (<Outlet /> on /delete) to state-based (useState + prop-controlled dialog)
  • All TanStack Router imports (useNavigate, Outlet) removed from view components
  • GeneralPage accepts an optional onDeleteSuccess callback; defaults to redirecting to origin
  • Backward compatible — OrganizationProfile continues working via the thin wrapper in general/index.tsx

@rohanchkrabrty rohanchkrabrty requested a review from rsbh February 24, 2026 20:44
@rohanchkrabrty rohanchkrabrty self-assigned this Feb 24, 2026
@coderabbitai
Copy link

coderabbitai bot commented Feb 24, 2026

📝 Walkthrough

Summary by CodeRabbit

  • Refactor
    • Consolidated and streamlined the organization general settings interface by restructuring the component architecture for improved modularity
    • Enhanced the organization deletion workflow with an improved controlled dialog pattern, offering better flexibility and control
    • Reorganized routing structure for settings management while preserving all permission checks and validation logic

Walkthrough

This PR refactors the organization general settings UI by introducing a new GeneralPage component, simplifying the main index, removing the delete route, converting DeleteOrganizationDialog to a controlled component, and introducing navigation callback patterns through new type definitions.

Changes

Cohort / File(s) Summary
Route and component simplification
web/sdk/react/components/organization/general/index.tsx, web/sdk/react/components/organization/routes.tsx
Removed GeneralDeleteOrganization component and its routing logic; simplified general index to delegate to GeneralPage with reduced state management (~130 lines removed).
Type system additions
web/sdk/react/components/organization/shared/types.ts
Added OnNavigate type and BasePageProps interface to support navigation callbacks across organization pages.
Dialog component refactoring
web/sdk/react/views/general/delete-organization-dialog.tsx
Converted DeleteOrganizationDialog from always-open to controlled component accepting open and onOpenChange props; removed router dependency and replaced page reload with onDeleteSuccess callback.
New GeneralPage component
web/sdk/react/views/general/general-page.tsx
Introduced new 127-line GeneralPage component managing organization settings UI, including permission checks, delete dialog state, and composition of GeneralOrganization and DeleteOrganizationDialog subcomponents.
Public API exports and minor updates
web/sdk/react/views/general/general-organization.tsx, web/sdk/react/views/general/general.module.css, web/sdk/react/views/general/index.ts
Exported GeneralOrganizationProps interface; updated AvatarUpload import path to alias; consolidated public re-exports of GeneralPage, GeneralOrganization, and DeleteOrganizationDialog with their prop types.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • paanSinghCoder
  • rsbh

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.

@vercel
Copy link

vercel bot commented Feb 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
frontier Ready Ready Preview, Comment Feb 24, 2026 8:45pm

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
web/sdk/react/views/general/delete-organization-dialog.tsx (1)

38-57: ⚠️ Potential issue | 🟠 Major

Form and checkbox state are not reset when the dialog reopens.

Previously, the delete dialog was route-mounted, so it remounted (and reset) on every navigation. Now that it's a controlled component that stays mounted, opening → typing → closing → reopening will show stale input and a pre-checked acknowledgment checkbox.

Reset the form and acknowledgment state when open changes:

Proposed fix — reset state on open
+import { useState, useEffect } from 'react';
 ...
 export const DeleteOrganizationDialog = ({
   open,
   onOpenChange,
   onDeleteSuccess
 }: DeleteOrganizationDialogProps) => {
   const {
     watch,
     handleSubmit,
     setError,
     formState: { errors, isSubmitting },
-    register
+    register,
+    reset
   } = useForm({
     resolver: yupResolver(orgSchema)
   });
   ...
   const [isAcknowledged, setIsAcknowledged] = useState(false);
+
+  useEffect(() => {
+    if (open) {
+      reset();
+      setIsAcknowledged(false);
+    }
+  }, [open, reset]);
🧹 Nitpick comments (2)
web/sdk/react/components/organization/general/index.tsx (1)

6-9: Use window.location.href instead of window.location to avoid @ts-ignore.

Assigning a string to window.location.href is type-safe and has the same effect as assigning to window.location.

♻️ Proposed fix
   return <GeneralPage onDeleteSuccess={() => {
-    // `@ts-ignore`
-    window.location = window.location.origin;
+    window.location.href = window.location.origin;
   }}/>;
web/sdk/react/views/general/delete-organization-dialog.tsx (1)

59-59: Consider typing the onSubmit parameter instead of any.

The data parameter can use the inferred schema type from yup (yup.InferType<typeof orgSchema>) to avoid any and get type safety on data.title.


ℹ️ 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 51d98c2 and 073071d.

📒 Files selected for processing (8)
  • web/sdk/react/components/organization/general/index.tsx
  • web/sdk/react/components/organization/routes.tsx
  • web/sdk/react/components/organization/shared/types.ts
  • web/sdk/react/views/general/delete-organization-dialog.tsx
  • web/sdk/react/views/general/general-organization.tsx
  • web/sdk/react/views/general/general-page.tsx
  • web/sdk/react/views/general/general.module.css
  • web/sdk/react/views/general/index.ts

Comment on lines +104 to +113
<Button
variant="solid"
color="danger"
type="submit"
onClick={() => setShowDeleteDialog(true)}
disabled={!canDeleteWorkspace}
data-test-id="frontier-sdk-delete-organization-btn"
>
Delete {t.organization({ case: 'lower' })}
</Button>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Delete button should use type="button", not type="submit".

This button is not inside a <form> — it opens a dialog via onClick. Using type="submit" can cause unintended form submission if this component is ever rendered inside an ancestor <form> element.

Proposed fix
                <Button
                  variant="solid"
                  color="danger"
-                  type="submit"
+                  type="button"
                  onClick={() => setShowDeleteDialog(true)}
                  disabled={!canDeleteWorkspace}
                  data-test-id="frontier-sdk-delete-organization-btn"
                >
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<Button
variant="solid"
color="danger"
type="submit"
onClick={() => setShowDeleteDialog(true)}
disabled={!canDeleteWorkspace}
data-test-id="frontier-sdk-delete-organization-btn"
>
Delete {t.organization({ case: 'lower' })}
</Button>
<Button
variant="solid"
color="danger"
type="button"
onClick={() => setShowDeleteDialog(true)}
disabled={!canDeleteWorkspace}
data-test-id="frontier-sdk-delete-organization-btn"
>
Delete {t.organization({ case: 'lower' })}
</Button>

@coveralls
Copy link

Pull Request Test Coverage Report for Build 22369338658

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 39.848%

Totals Coverage Status
Change from base Build 22339802350: 0.0%
Covered Lines: 13595
Relevant Lines: 34117

💛 - Coveralls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants