import type { PluginLayoutProps } from "@idea/plugin-sdk"; import type { ReactElement } from "react"; import { useMemo, useState } from "react"; let hasLoggedFirstLayoutRender = false; export function HelloWorldLayout(props: PluginLayoutProps): ReactElement { const [localClicks, setLocalClicks] = useState(0); const hostState = useMemo(() => { return typeof props.state === "object" && props.state !== null && !Array.isArray(props.state) ? (props.state as Record) : {}; }, [props.state]); const persistedClicks = typeof hostState.clicks === "number" && Number.isFinite(hostState.clicks) ? hostState.clicks : 0; if (!hasLoggedFirstLayoutRender) { hasLoggedFirstLayoutRender = true; console.info("[hello-plugin] layout first render", { projectId: props.projectId, nodeId: props.nodeId, layoutType: props.layoutType, hasState: props.state !== undefined }); } return (

Hello Plugin

React layout rendered by IdeA host React.

Project
{props.projectId}
Layout
{props.layoutType}
); }