📌 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:
@@ -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 (
|
||||
|
||||
@@ -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}`;
|
||||
|
||||
Reference in New Issue
Block a user