diff --git a/apps/web/next-env.d.ts b/apps/web/next-env.d.ts index 1511519..9edff1c 100644 --- a/apps/web/next-env.d.ts +++ b/apps/web/next-env.d.ts @@ -1,6 +1,6 @@ /// /// -import './.next/types/routes.d.ts'; +import "./.next/types/routes.d.ts"; // NOTE: This file should not be edited // see https://nextjs.org/docs/app/api-reference/config/typescript for more information. diff --git a/apps/web/src/app/playground/page.tsx b/apps/web/src/app/playground/page.tsx index 675424a..2d8860a 100644 --- a/apps/web/src/app/playground/page.tsx +++ b/apps/web/src/app/playground/page.tsx @@ -30,6 +30,9 @@ import Link from 'next/link'; import { useState } from 'react'; import { ThemeToggle } from '../../components/ThemeToggle'; +// Disable static generation for this page due to context provider requirements +export const dynamic = 'force-dynamic'; + export default function PlaygroundPage() { const [activeTab, setActiveTab] = useState('all'); const [progress, setProgress] = useState(65); diff --git a/packages/ui/src/Radio/RadioGroup.tsx b/packages/ui/src/Radio/RadioGroup.tsx index 2b8eb47..c7be37a 100644 --- a/packages/ui/src/Radio/RadioGroup.tsx +++ b/packages/ui/src/Radio/RadioGroup.tsx @@ -15,7 +15,20 @@ export const RadioGroupContext = createContext(nu export const useRadioGroup = () => { const context = useContext(RadioGroupContext); if (!context) { - throw new Error('Radio must be used within a RadioGroup'); + // During SSR/prerendering, context might not be available yet + // Only throw during actual runtime (browser or test environment) + if (typeof window !== 'undefined' || process.env.NODE_ENV === 'test') { + throw new Error('Radio must be used within a RadioGroup'); + } + // Return default values for SSR/prerendering + return { + name: '', + value: undefined, + onChange: () => {}, + state: 'default' as const, + size: 'md' as const, + disabled: false, + }; } return context; };