Skip to content

Commit db9f9ec

Browse files
committed
FF react grab
1 parent 0a860b3 commit db9f9ec

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

apps/sim/app/layout.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { generateBrandedMetadata, generateStructuredData } from '@/lib/branding/
77
import { PostHogProvider } from '@/app/_shell/providers/posthog-provider'
88
import '@/app/_styles/globals.css'
99
import { OneDollarStats } from '@/components/analytics/onedollarstats'
10+
import { isReactGrabEnabled } from '@/lib/core/config/feature-flags'
1011
import { HydrationErrorHandler } from '@/app/_shell/hydration-error-handler'
1112
import { QueryProvider } from '@/app/_shell/providers/query-provider'
1213
import { SessionProvider } from '@/app/_shell/providers/session-provider'
@@ -33,14 +34,14 @@ export default function RootLayout({ children }: { children: React.ReactNode })
3334
return (
3435
<html lang='en' suppressHydrationWarning>
3536
<head>
36-
{process.env.NODE_ENV === 'development' && (
37+
{isReactGrabEnabled && (
3738
<Script
3839
src='//unpkg.com/react-grab/dist/index.global.js'
3940
crossOrigin='anonymous'
4041
strategy='beforeInteractive'
4142
/>
4243
)}
43-
{process.env.NODE_ENV === 'development' && (
44+
{isReactGrabEnabled && (
4445
<Script
4546
src='//unpkg.com/@react-grab/cursor/dist/client.global.js'
4647
strategy='lazyOnload'

apps/sim/lib/core/config/env.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,9 @@ export const env = createEnv({
260260
// Invitations - for self-hosted deployments
261261
DISABLE_INVITATIONS: z.boolean().optional(), // Disable workspace invitations globally (for self-hosted deployments)
262262

263+
// Development Tools
264+
REACT_GRAB_ENABLED: z.boolean().optional(), // Enable React Grab for UI element debugging in Cursor/AI agents (dev only)
265+
263266
// SSO Configuration (for script-based registration)
264267
SSO_ENABLED: z.boolean().optional(), // Enable SSO functionality
265268
SSO_PROVIDER_TYPE: z.enum(['oidc', 'saml']).optional(), // [REQUIRED] SSO provider type

apps/sim/lib/core/config/feature-flags.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,12 @@ export const isE2bEnabled = isTruthy(env.E2B_ENABLED)
111111
*/
112112
export const isInvitationsDisabled = isTruthy(env.DISABLE_INVITATIONS)
113113

114+
/**
115+
* Is React Grab enabled for UI element debugging
116+
* When true and in development mode, enables React Grab for copying UI element context to clipboard
117+
*/
118+
export const isReactGrabEnabled = isDev && isTruthy(env.REACT_GRAB_ENABLED)
119+
114120
/**
115121
* Get cost multiplier based on environment
116122
*/

apps/sim/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"node": ">=20.0.0"
99
},
1010
"scripts": {
11-
"dev": "bunx @react-grab/cursor@latest && next dev --port 3000",
11+
"dev": "next dev --port 3000",
1212
"dev:webpack": "next dev --webpack",
1313
"dev:sockets": "bun run socket/index.ts",
1414
"dev:full": "bunx concurrently -n \"App,Realtime\" -c \"cyan,magenta\" \"bun run dev\" \"bun run dev:sockets\"",

0 commit comments

Comments
 (0)