From 9f266a351c8396319f9df352dd291ccfd3d5b1e4 Mon Sep 17 00:00:00 2001 From: Bohdan Triapitsyn Date: Tue, 16 Jun 2026 15:33:33 +0300 Subject: [PATCH] fix: preload commands and skills when draft session opens so pinned starters appear immediately Draft starters from commands and skills now resolve on mount without needing to open the add dialog Uses existing TTL-cached and deduped loaders, so no extra cost if already loaded --- packages/ui/src/components/chat/useDraftStarters.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/ui/src/components/chat/useDraftStarters.ts b/packages/ui/src/components/chat/useDraftStarters.ts index 619f1baf..86a5789a 100644 --- a/packages/ui/src/components/chat/useDraftStarters.ts +++ b/packages/ui/src/components/chat/useDraftStarters.ts @@ -93,6 +93,14 @@ export function useDraftStarters(): UseDraftStartersResult { void useSkillsStore.getState().loadSkills?.(); }, []); + // Preload commands and skills on mount so that pinned command/skill starters + // resolve immediately without requiring the user to open the add dialog first. + // Both loaders are TTL-cached and in-flight-deduped, so this is a cheap no-op + // if they were already loaded. + React.useEffect(() => { + ensureLoaded(); + }, [ensureLoaded]); + const commandNames = React.useMemo(() => new Set(commands.map((c) => c.name)), [commands]); const skillNames = React.useMemo(() => new Set(skills.map((s) => s.name)), [skills]);