From d5e9b035de6be9db784b2cd7a28cf552bbaffedf Mon Sep 17 00:00:00 2001 From: 1pitaph Date: Sat, 30 May 2026 21:03:03 +0800 Subject: [PATCH 1/2] chore(dev): gate react-scan overlay behind env flag Remove the automatic react-scan CDN injection in development and only enable the local react-scan package when NEXT_PUBLIC_REACT_SCAN=true. Document the opt-in flag in .env.example. --- .env.example | 3 +++ apps/editor/app/client-bootstrap.tsx | 5 ++++- apps/editor/app/layout.tsx | 5 ----- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.env.example b/.env.example index daa84046e..303263a99 100644 --- a/.env.example +++ b/.env.example @@ -3,5 +3,8 @@ # Google Maps API key (enables address search) # NEXT_PUBLIC_GOOGLE_MAPS_API_KEY=your_google_maps_api_key +# React render debugging overlay (disabled by default) +# NEXT_PUBLIC_REACT_SCAN=false + # Dev server port (default: 3000) # PORT=3000 diff --git a/apps/editor/app/client-bootstrap.tsx b/apps/editor/app/client-bootstrap.tsx index 610eac4e6..892856d9d 100644 --- a/apps/editor/app/client-bootstrap.tsx +++ b/apps/editor/app/client-bootstrap.tsx @@ -11,9 +11,12 @@ import '../lib/bootstrap' import { type ReactNode, useEffect } from 'react' +const shouldEnableReactScan = + process.env.NODE_ENV === 'development' && process.env.NEXT_PUBLIC_REACT_SCAN === 'true' + export function ClientBootstrap({ children }: { children: ReactNode }) { useEffect(() => { - if (process.env.NODE_ENV !== 'development') return + if (!shouldEnableReactScan) return // Loaded here (not via a `