fix: Prevent duplicate or inactive tools/prompts after server refresh (#5850)

This commit is contained in:
Harold Mciver
2025-08-13 19:31:24 +00:00
committed by GitHub
parent c0c0e9b7a0
commit 8fae227e8d
5 changed files with 36 additions and 1 deletions

View File

@@ -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 (