fix: empty outlet in admin org routes by rsbh · Pull Request #1407 · raystack/frontier

@rsbh

Summary

This PR moves the from sdk package to admin apps and both are getting different instance of router and screens are not getting rendered.

Changes

Technical Details

Test Plan

  • Manual testing completed
  • Build and type checking passes

@rsbh

@vercel

@coderabbitai

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent 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 d6c0c3b and ac1005b.

📒 Files selected for processing (1)
  • web/sdk/admin/views/preferences/layout.tsx
💤 Files with no reviewable changes (1)
  • web/sdk/admin/views/preferences/layout.tsx

📝 Walkthrough

Summary by CodeRabbit

  • Refactor
    • Reworked organization details to use a centralized context, improving reliability and maintainability without changing user workflows.
  • New Features
    • Added an "Add Domain" section on the organization security page.
  • Bug Fixes
    • Improved null-safety for organization data to prevent intermittent errors and ensure consistent titles and lists.
  • Chores
    • Removed the previous preferences layout implementation.

Walkthrough

Replaces React Router Outlet/OutletContext usage with a children-based OrganizationDetails API and OrganizationContext access. Parent page now renders OrganizationDetails wrapping an Outlet; nested views obtain organization from OrganizationContext and null-safe optional chaining was added.

Changes

Cohort / File(s) Summary
Routing entry
web/apps/admin/src/pages/organizations/details/index.tsx
Switched OrganizationDetails from a self-closing component to a wrapper that contains an Outlet; imports reorganized to include Outlet.
OrganizationDetails API
web/sdk/admin/views/organizations/details/index.tsx
Removed Outlet/OutletContext usage; added children?: React.ReactNode prop and now renders passed children inside layout.
Child views — security
web/sdk/admin/views/organizations/details/security/block-organization.tsx, web/sdk/admin/views/organizations/details/security/domains-list.tsx, web/sdk/admin/views/organizations/details/security/index.tsx
Replaced useOutletContext with useContext(OrganizationContext); removed OutletContext imports; added optional chaining (organization?.id, organization?.title) where needed.
Types cleanup
web/sdk/admin/views/organizations/details/types.ts
Removed exported OutletContext interface.
Preferences layout removal
web/sdk/admin/views/preferences/layout.tsx
Deleted PreferencesLayout component and its data-fetching/Outlet context provisioning.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs


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.

paanSinghCoder

coderabbitai[bot]

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/admin/views/organizations/details/index.tsx (1)

286-296: ⚠️ Potential issue | 🔴 Critical

Fix prop type mismatch for children.

OrganizationDetailsLayout requires children: React.ReactNode (line 16 in layout/index.tsx), but OrganizationDetails defines it as optional (children?: React.ReactNode in OrganizationDetailsProps). This type mismatch means passing undefined children violates the layout's type contract. Either make children required in OrganizationDetailsProps or optional in OrganizationDetailsLayoutProps.

🧹 Nitpick comments (2)
web/sdk/admin/views/organizations/details/security/index.tsx (2)

13-13: Duplicate react import — merge into one.

Lines 13 and 24 both import from 'react'. These should be consolidated.

♻️ Proposed fix
-import { useContext } from 'react';
+import { useContext, useEffect } from 'react';
 import { OrganizationContext } from '../contexts/organization-context';
 import { BlockOrganizationSection } from './block-organization';
 import { DomainsList } from './domains-list';
 import { PageTitle } from '../../../../components/PageTitle';
 import { useQuery } from '@connectrpc/connect-query';
 import {
   FrontierServiceQueries,
   ListOrganizationDomainsRequestSchema
 } from '@raystack/proton/frontier';
 import { create } from '@bufbuild/protobuf';
-import { useEffect } from 'react';

Also applies to: 24-24


82-85: ?? [] fallback is redundant.

The select function already guarantees domains is always an array (data?.domains || []), so the ?? [] at the call site is unreachable.

♻️ Proposed fix
-          domains={domains ?? []}
+          domains={domains}

ℹ️ 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 3395789 and d6c0c3b.

📒 Files selected for processing (6)
  • web/apps/admin/src/pages/organizations/details/index.tsx
  • web/sdk/admin/views/organizations/details/index.tsx
  • web/sdk/admin/views/organizations/details/security/block-organization.tsx
  • web/sdk/admin/views/organizations/details/security/domains-list.tsx
  • web/sdk/admin/views/organizations/details/security/index.tsx
  • web/sdk/admin/views/organizations/details/types.ts

@coveralls

Pull Request Test Coverage Report for Build 22301602536

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 22297745104: 0.0%
Covered Lines: 16200
Relevant Lines: 42125

💛 - Coveralls

@rsbh @claude

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@rsbh rsbh deleted the fix_admin_ui_outlet branch

February 23, 2026 10:20