From 712f0b3ca20551d5fd825e52cb19dd1c0717c32f Mon Sep 17 00:00:00 2001 From: Danny Avila Date: Sat, 27 Sep 2025 17:21:48 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=8C=20fix:=20Exclude=20Pinned=20Keys?= =?UTF-8?q?=20from=20Cleanup=20and=20Fix=20MCP=20Pin=20State=20(#9867)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: Prevent MCPSelect from rendering when not pinned and no values are available * fix: Exclude 'pinned' keys from timestamped storage cleanup logic * fix: Safeguard MCPSelect rendering by adding optional chaining for mcpValues --- client/src/components/Chat/Input/MCPSelect.tsx | 5 +++++ client/src/utils/timestamps.ts | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/client/src/components/Chat/Input/MCPSelect.tsx b/client/src/components/Chat/Input/MCPSelect.tsx index bd76ebbc42..9482581802 100644 --- a/client/src/components/Chat/Input/MCPSelect.tsx +++ b/client/src/components/Chat/Input/MCPSelect.tsx @@ -8,6 +8,7 @@ function MCPSelectContent() { const { conversationId, mcpServerManager } = useBadgeRowContext(); const { localize, + isPinned, mcpValues, isInitializing, placeholderText, @@ -68,6 +69,10 @@ function MCPSelectContent() { [getServerStatusIconProps, isInitializing], ); + if (!isPinned && mcpValues?.length === 0) { + return null; + } + const configDialogProps = getConfigDialogProps(); return ( diff --git a/client/src/utils/timestamps.ts b/client/src/utils/timestamps.ts index 1fdb6923da..db114263f8 100644 --- a/client/src/utils/timestamps.ts +++ b/client/src/utils/timestamps.ts @@ -84,7 +84,9 @@ export function cleanupTimestampedStorage(): void { } // Check if this key should be timestamped - const isTimestampedKey = TIMESTAMPED_KEYS.some((prefix) => key.startsWith(prefix)); + const isTimestampedKey = TIMESTAMPED_KEYS.some( + (prefix) => key.startsWith(prefix) && !key.includes('pinned'), + ); if (isTimestampedKey && !key.endsWith(TIMESTAMP_SUFFIX)) { const timestampKey = `${key}${TIMESTAMP_SUFFIX}`;