Skip to content

chore(refactor): convert components to server components and split enterprise/pricing#3716

Merged
waleedlatif1 merged 1 commit intosimstudioai:stagingfrom
adithyaakrishna:feat/split-v1
Mar 23, 2026
Merged

chore(refactor): convert components to server components and split enterprise/pricing#3716
waleedlatif1 merged 1 commit intosimstudioai:stagingfrom
adithyaakrishna:feat/split-v1

Conversation

@adithyaakrishna
Copy link
Contributor

@adithyaakrishna adithyaakrishna commented Mar 23, 2026

Summary

  • Audit all use client files in apps/sim/ and remove the directive from files that don't need it

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Other:Perf Optimization

Testing

No runtime behavior changes — components render identically

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@cursor
Copy link

cursor bot commented Mar 23, 2026

PR Summary

Medium Risk
Mostly refactors component boundaries between server and client; risk is limited to potential hydration/RSC boundary issues if any component still relies on client-only behavior or context.

Overview
Refactors apps/sim to remove unnecessary use client directives, converting multiple presentational/loading/layout components to server components.

Splits previously inline interactive UI into dedicated client components: Enterprise now imports AccessControlPanel and AuditLogPreview, and the landing pricing section now renders a client PricingGrid (with PricingCard) while the section wrapper becomes a server component.

Written by Cursor Bugbot for commit bf6fe40. This will update automatically on new commits. Configure here.

@vercel
Copy link

vercel bot commented Mar 23, 2026

@adithyaakrishna is attempting to deploy a commit to the Sim Team on Vercel.

A member of the Team first needs to authorize it.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 23, 2026

Greptile Summary

This PR audits 'use client' directives across apps/sim/ and removes them from 17 files that don't use React hooks, state, effects, or browser APIs — reducing the client JavaScript bundle. For two components that do require client-side interactivity (enterprise.tsx and landing-pricing.tsx), the interactive sub-components are correctly split out into dedicated files (access-control-panel.tsx, audit-log-preview.tsx, pricing-card.tsx) that retain 'use client', while the parent shells become server components.

Key changes:

  • Client boundary removal (17 files): Static layout wrappers, pure rendering helpers, EMCN primitives (Badge, Breadcrumb, Table), and thin re-export files had 'use client' stripped — all verified to use no hooks or browser APIs.
  • Enterprise split: AccessControlPanel (uses useState/useRef/useInView) and AuditLogPreview (uses useState/useEffect for interval-driven animation) are extracted to components/ sub-files with their own 'use client' directives.
  • Pricing split: PricingCard/PricingGrid (uses useState/useRouter) are extracted to components/pricing-card.tsx; the now-unused index prop is cleanly removed in the process.
  • Workspace layout: layout.tsx is now a server component; all child providers (GlobalCommandsProvider, WorkspacePermissionsProvider, ToastProvider, Sidebar) each carry their own 'use client' boundary, which is the correct composition pattern for Next.js App Router.

Confidence Score: 5/5

  • Safe to merge — a clean, mechanical refactor with no behavior changes and no new bugs introduced.
  • Every file that lost 'use client' was verified to contain no React hooks, no browser APIs, and no event handlers. The two large components that needed client behavior were correctly split rather than blindly de-cliented. All child providers of the workspace layout retain their own 'use client' boundary, so no RSC/client boundary violation exists. No refs are passed to the now-shared Table components. The unused 'index' prop removal in PricingCard is confirmed safe (prop was never read inside the function body).
  • No files require special attention.

Important Files Changed

Filename Overview
apps/sim/app/(home)/components/enterprise/enterprise.tsx Correctly removes 'use client' by extracting interactive sub-components (AccessControlPanel, AuditLogPreview) to their own files; remaining JSX is purely static with no hooks.
apps/sim/app/(home)/components/enterprise/components/access-control-panel.tsx New file extracted from enterprise.tsx; correctly marks 'use client' since it uses useState, useRef, and useInView hooks. Logic is identical to what was in the original file.
apps/sim/app/(home)/components/enterprise/components/audit-log-preview.tsx New file extracted from enterprise.tsx; correctly marks 'use client' since it uses useState, useEffect, and useRef. The [, tick] = useState(0) pattern is valid for forced re-renders of time labels.
apps/sim/app/(landing)/components/landing-pricing/landing-pricing.tsx Correctly converted to server component; delegates interactive pricing grid to PricingGrid (client component in pricing-card.tsx).
apps/sim/app/(landing)/components/landing-pricing/components/pricing-card.tsx New file extracted from landing-pricing.tsx; correctly marks 'use client' for useState and useRouter. The unused 'index' prop was cleanly removed from PricingCard's signature during the refactor.
apps/sim/app/workspace/[workspaceId]/layout.tsx Correctly converted to a server component; all children (ToastProvider, GlobalCommandsProvider, WorkspacePermissionsProvider, Sidebar) carry their own 'use client' boundaries and are safe to render from a server component.
apps/sim/components/emcn/components/table/table.tsx Removes 'use client' from a component that uses React.forwardRef. Since no callers pass refs to these table components (confirmed by search), the change is safe; the shared module is included in client bundles when imported by client components.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    subgraph Before["Before (enterprise.tsx — single 'use client' file)"]
        E1["enterprise.tsx\n'use client'\n• AuditLogPreview (useState, useEffect)\n• AccessControlPanel (useState, useRef, useInView)\n• Static enterprise layout"]
    end

    subgraph After["After (server + client split)"]
        E2["enterprise.tsx\nServer Component\n• Static layout, Image, Link, Badge"]
        ACP["access-control-panel.tsx\n'use client'\n• useState, useRef, useInView"]
        ALP["audit-log-preview.tsx\n'use client'\n• useState, useEffect, setInterval"]
        E2 -->|imports| ACP
        E2 -->|imports| ALP
    end

    subgraph PricingSplit["After (landing-pricing split)"]
        LP["landing-pricing.tsx\nServer Component"]
        PC["pricing-card.tsx\n'use client'\n• PricingCard (useState, useRouter)\n• PricingGrid (exported)"]
        LP -->|imports PricingGrid| PC
    end

    Before --> After
    Before --> PricingSplit
Loading

Reviews (1): Last reviewed commit: "chore: client and server components" | Re-trigger Greptile

@vercel
Copy link

vercel bot commented Mar 23, 2026

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

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment Mar 23, 2026 5:44pm

Request Review

@waleedlatif1 waleedlatif1 merged commit 694b530 into simstudioai:staging Mar 23, 2026
11 of 12 checks passed
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