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
This commit is contained in:
Bohdan Triapitsyn
2026-06-16 15:33:33 +03:00
parent 91de51d1a5
commit 9f266a351c
@@ -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]);