📌 fix: Exclude Pinned Keys from Cleanup and Fix MCP Pin State (#9867)

* 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
This commit is contained in:
Danny Avila
2025-09-27 17:21:48 -04:00
committed by GitHub
parent 062d813b21
commit 712f0b3ca2
2 changed files with 8 additions and 1 deletions

View File

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

View File

@@ -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}`;