From 39f885a1a9bc592b833bb574beba48ecfb1d6648 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Wed, 6 May 2026 03:40:34 +0200 Subject: [PATCH] Refactor: Extract database picker UI into ChatDatabasePicker component and update state management logic --- src/App.jsx | 86 +++++++---------------------------------------------- 1 file changed, 11 insertions(+), 75 deletions(-) diff --git a/src/App.jsx b/src/App.jsx index ad8684b..5794ccd 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -1505,8 +1505,7 @@ async function regenerateFromIndex(index, overrideUserText = null) { setLibraryJobs([]) setActiveLibrarySlug(null) setEditingLibrarySlug(null) - setIsDbPickerOpen(false) - setChatLibraryBySession({}) + clearChatLibrarySelections() await refreshLibraries() await refreshLibraryJobs() } @@ -2270,11 +2269,7 @@ async function createNewChat() { .then(() => { const newSessions = chatSessions.filter(s => s.session_id !== sessionId); setChatSessions(newSessions); - setChatLibraryBySession(prev => { - const next = { ...(prev || {}) } - delete next[sessionId] - return next - }) + setChatLibraryForSession(sessionId, null) if (activeSessionId === sessionId) { setActiveSessionId(newSessions.length > 0 ? newSessions[0].session_id : null); } @@ -2744,74 +2739,15 @@ async function createNewChat() { placeholder="Ask any question..." maxRows={13} /> -
- - {isDbPickerOpen && ( -
- - {libraries.length === 0 ? ( -
No databases yet.
- ) : ( - libraries.map(library => { - const selected = chatLibrarySlug === library.slug - const syncing = isLibrarySyncing(library.slug) - const status = !library.files?.length - ? 'Empty' - : library.states?.is_indexed - ? 'Ready' - : syncing - ? 'Syncing' - : 'Needs sync' - - return ( - - ) - }) - )} -
- )} -
+