summaryrefslogtreecommitdiff
path: root/packages/cli/src/ui/hooks/slashCommandProcessor.ts
diff options
context:
space:
mode:
authorHarold Mciver <[email protected]>2025-08-13 19:31:24 +0000
committerGitHub <[email protected]>2025-08-13 19:31:24 +0000
commit8fae227e8d53b962f8b7db3abff51906fad1d181 (patch)
tree1bf42ec8896ca5d1b6a310a89d36e52028ccd393 /packages/cli/src/ui/hooks/slashCommandProcessor.ts
parentc0c0e9b7a0a768515181e6ae7defe9f06199ea18 (diff)
fix: Prevent duplicate or inactive tools/prompts after server refresh (#5850)
Diffstat (limited to 'packages/cli/src/ui/hooks/slashCommandProcessor.ts')
-rw-r--r--packages/cli/src/ui/hooks/slashCommandProcessor.ts9
1 files changed, 8 insertions, 1 deletions
diff --git a/packages/cli/src/ui/hooks/slashCommandProcessor.ts b/packages/cli/src/ui/hooks/slashCommandProcessor.ts
index b4ce0d4d..32f55de2 100644
--- a/packages/cli/src/ui/hooks/slashCommandProcessor.ts
+++ b/packages/cli/src/ui/hooks/slashCommandProcessor.ts
@@ -57,6 +57,11 @@ export const useSlashCommandProcessor = (
) => {
const session = useSessionStats();
const [commands, setCommands] = useState<readonly SlashCommand[]>([]);
+ const [reloadTrigger, setReloadTrigger] = useState(0);
+
+ const reloadCommands = useCallback(() => {
+ setReloadTrigger((v) => v + 1);
+ }, []);
const [shellConfirmationRequest, setShellConfirmationRequest] =
useState<null | {
commands: string[];
@@ -172,6 +177,7 @@ export const useSlashCommandProcessor = (
toggleCorgiMode,
toggleVimEnabled,
setGeminiMdFileCount,
+ reloadCommands,
},
session: {
stats: session.stats,
@@ -195,6 +201,7 @@ export const useSlashCommandProcessor = (
toggleVimEnabled,
sessionShellAllowlist,
setGeminiMdFileCount,
+ reloadCommands,
],
);
@@ -220,7 +227,7 @@ export const useSlashCommandProcessor = (
return () => {
controller.abort();
};
- }, [config, ideMode]);
+ }, [config, ideMode, reloadTrigger]);
const handleSlashCommand = useCallback(
async (