From 392c59bdc9488909d3ed2458b60b209eb8938b8d Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Tue, 31 Mar 2026 13:32:03 +0000 Subject: [PATCH] Fix dead code, isEditing guard, and empty state condition - Remove unused hashCode function from markdown-text.tsx (leftover from removed artifacts feature) - Include editing state in isEditing check so Cancel button stays visible when user clears name/content fields while editing an existing prompt - Fix empty state message to only show when no items exist in any section (pinned, folders, or unfiled), not just when filteredItems is empty --- .../src/components/assistant-ui/markdown-text.tsx | 9 --------- .../features/chat/components/prompt-library-sheet.tsx | 2 +- studio/frontend/src/features/chat/thread-sidebar.tsx | 2 +- 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/studio/frontend/src/components/assistant-ui/markdown-text.tsx b/studio/frontend/src/components/assistant-ui/markdown-text.tsx index b7bfd76b22..f67388f340 100644 --- a/studio/frontend/src/components/assistant-ui/markdown-text.tsx +++ b/studio/frontend/src/components/assistant-ui/markdown-text.tsx @@ -50,15 +50,6 @@ type CodeFence = { source: string; }; -function hashCode(str: string): string { - let hash = 0; - for (let i = 0; i < str.length; i++) { - const char = str.charCodeAt(i); - hash = ((hash << 5) - hash + char) | 0; - } - return Math.abs(hash).toString(36); -} - function getMermaidSource(blockContent: string): string | null { const source = blockContent.match(MERMAID_SOURCE_RE)?.[1]?.trim(); return source && source.length > 0 ? source : null; diff --git a/studio/frontend/src/features/chat/components/prompt-library-sheet.tsx b/studio/frontend/src/features/chat/components/prompt-library-sheet.tsx index d92c0b9d0c..db4d4e7ea3 100644 --- a/studio/frontend/src/features/chat/components/prompt-library-sheet.tsx +++ b/studio/frontend/src/features/chat/components/prompt-library-sheet.tsx @@ -88,7 +88,7 @@ export const PromptLibrarySheet: FC<{ ); const items = prompts ?? []; - const isEditing = name !== "" || content !== ""; + const isEditing = editing !== null || name !== "" || content !== ""; return ( diff --git a/studio/frontend/src/features/chat/thread-sidebar.tsx b/studio/frontend/src/features/chat/thread-sidebar.tsx index afbb9d422b..11aedb0a53 100644 --- a/studio/frontend/src/features/chat/thread-sidebar.tsx +++ b/studio/frontend/src/features/chat/thread-sidebar.tsx @@ -448,7 +448,7 @@ export function ThreadSidebar({ {unfiledItems.map(renderItem)} - {filteredItems.length === 0 && ( + {unfiledItems.length === 0 && pinnedItems.length === 0 && folderedItems.size === 0 && (

{debouncedQuery.trim() ? "No matching threads" : "No threads yet"}