SSR fix: - ClientOnly wrapper prevents Leaflet/Yjs from running during SSR - SessionView lazy-loaded to avoid browser API usage on server Automerge fix: - Set MERGE_READY_STATE to 'clean' only (was including 'unstable') - Prevents merging before all CI checks complete Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
17 lines
346 B
TypeScript
17 lines
346 B
TypeScript
import { useState, useEffect, type ReactNode } from "react";
|
|
|
|
export function ClientOnly({
|
|
children,
|
|
fallback = null,
|
|
}: {
|
|
children: () => ReactNode;
|
|
fallback?: ReactNode;
|
|
}) {
|
|
const [mounted, setMounted] = useState(false);
|
|
|
|
useEffect(() => {
|
|
setMounted(true);
|
|
}, []);
|
|
|
|
return mounted ? <>{children()}</> : <>{fallback}</>;
|
|
}
|