improved a lot of things
This commit is contained in:
@@ -43,10 +43,17 @@ export function LiveArtboard({
|
||||
onComponentSelected,
|
||||
style,
|
||||
}: LiveArtboardProps) {
|
||||
const iframeRef = useRef<HTMLIFrameElement>(null);
|
||||
const iframeRef = useRef<HTMLIFrameElement>(null);
|
||||
// Track whether the iframe has sent READY so we don't send messages too early.
|
||||
const isReadyRef = useRef(false);
|
||||
|
||||
// Reset ready state whenever src changes. Without this, isReadyRef stays
|
||||
// true from the previous page, causing design-token / selection effects to
|
||||
// fire against a half-loaded iframe between navigation and the new READY.
|
||||
useEffect(() => {
|
||||
isReadyRef.current = false;
|
||||
}, [src]);
|
||||
|
||||
// ── Send a typed message to the iframe ───────────────────────────────────
|
||||
const sendMessage = useCallback(
|
||||
(type: Parameters<typeof createHostEnvelope>[1]['type'], payload?: Record<string, unknown>) => {
|
||||
@@ -85,6 +92,10 @@ export function LiveArtboard({
|
||||
case 'COMPONENT_SELECTED':
|
||||
onComponentSelected?.(msg.nodeId);
|
||||
break;
|
||||
case 'COMPONENT_DESELECTED':
|
||||
// Renderer clicked empty space — clear the host-side selection.
|
||||
onComponentSelected?.('');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -107,7 +107,9 @@ export const TOUR_STEPS: TourStep[] = [
|
||||
</>
|
||||
),
|
||||
codeBlock: `# Terminal 2 — keep your dev server running in Terminal 1
|
||||
npx @originmain/cli dev --target http://localhost:3000
|
||||
# From the monorepo root:
|
||||
pnpm cli:build # one-time build (skip if already built)
|
||||
pnpm cli:dev --target http://localhost:3000
|
||||
|
||||
# ✓ Proxy listening on http://localhost:4170
|
||||
# Paste http://localhost:4170 into the artboard URL input`,
|
||||
|
||||
Reference in New Issue
Block a user