Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
import { useState, type ReactNode } from 'react';
/** Closed sheets need neither their hooks nor eagerly constructed JSX on entry.
* Once opened, retain them so draft state and the existing dismissal lifecycle
* continue to belong to the sheet (including rapid close/reopen). */
export function MountOnFirstOpen({ open, children }: { open: boolean; children: () => ReactNode }) {
const [opened, setOpened] = useState(open);
if (open && !opened) setOpened(true);
return open || opened ? children() : null;
}