@@ -43,7 +43,6 @@ import { isChatEnabled } from '@/lib/core/config/env-flags'
4343import { isMacPlatform } from '@/lib/core/utils/platform'
4444import { buildFolderTree , getFolderPathNames } from '@/lib/folders/tree'
4545import { captureEvent } from '@/lib/posthog/client'
46- import { parseWorkspaceFileFolderDisplayPath } from '@/lib/workspace-files/folder-display-path'
4746import { CONNECT_MODE } from '@/app/workspace/[workspaceId]/integrations/connect-route'
4847import { useRegisterGlobalCommands } from '@/app/workspace/[workspaceId]/providers/global-commands-provider'
4948import { useWorkspaceHostContext } from '@/app/workspace/[workspaceId]/providers/workspace-host-provider'
@@ -100,7 +99,6 @@ import { useImportWorkflow } from '@/app/workspace/[workspaceId]/w/hooks'
10099import { useCustomBlockOverlayVersion } from '@/blocks/custom/client-overlay'
101100import { useWorkspaceCredentials } from '@/hooks/queries/credentials'
102101import { useFolderMap , useFolders } from '@/hooks/queries/folders'
103- import { useKnowledgeBasesQuery } from '@/hooks/queries/kb/knowledge'
104102import { type LogFilters , useLogsList } from '@/hooks/queries/logs'
105103import type { MothershipChatMetadata } from '@/hooks/queries/mothership-chats'
106104import {
@@ -112,10 +110,8 @@ import {
112110 useRenameMothershipChat ,
113111 useSetMothershipChatPinned ,
114112} from '@/hooks/queries/mothership-chats'
115- import { useTablesList } from '@/hooks/queries/tables'
116113import { useUpdateWorkflow } from '@/hooks/queries/workflows'
117114import type { Workspace } from '@/hooks/queries/workspace'
118- import { useWorkspaceFiles } from '@/hooks/queries/workspace-files'
119115import { useMothershipChatEvents } from '@/hooks/use-mothership-chat-events'
120116import { usePermissionConfig } from '@/hooks/use-permission-config'
121117import { useSettingsNavigation } from '@/hooks/use-settings-navigation'
@@ -600,17 +596,6 @@ export const Sidebar = memo(function Sidebar({
600596
601597 useFolders ( workspaceId )
602598 const { data : folderMap = EMPTY_FOLDER_MAP } = useFolderMap ( workspaceId )
603- // Tables and knowledge bases keep their folders in the generic folder tree,
604- // keyed by resource type, so each needs its own map to resolve a path. Both resolve
605- // paths for search-modal rows only, so they wait for the palette like its lists do.
606- const { data : tableFolderMap = EMPTY_FOLDER_MAP } = useFolderMap (
607- isSearchModalOpen && ! permissionConfig . hideTablesTab ? workspaceId : undefined ,
608- 'table'
609- )
610- const { data : knowledgeBaseFolderMap = EMPTY_FOLDER_MAP } = useFolderMap (
611- isSearchModalOpen && ! permissionConfig . hideKnowledgeBaseTab ? workspaceId : undefined ,
612- 'knowledge_base'
613- )
614599 const updateWorkflowMutation = useUpdateWorkflow ( )
615600
616601 const folderTree = useMemo (
@@ -904,68 +889,6 @@ export const Sidebar = memo(function Sidebar({
904889 [ fetchedChats , workspaceId ]
905890 )
906891
907- /**
908- * Search-modal data only. The sidebar renders on every workspace route, so fetching
909- * these workspace-wide lists eagerly cost three requests per cold load to populate a
910- * palette most sessions never open. React Query keeps what it has once fetched, so
911- * reopening the palette is served from cache.
912- */
913- const { data : fetchedTables = [ ] } = useTablesList ( workspaceId , 'active' , {
914- enabled : isSearchModalOpen && ! permissionConfig . hideTablesTab ,
915- } )
916- const { data : fetchedFiles = [ ] } = useWorkspaceFiles ( workspaceId , 'active' , {
917- enabled : isSearchModalOpen && ! permissionConfig . hideFilesTab ,
918- } )
919- const { data : fetchedKnowledgeBases = [ ] } = useKnowledgeBasesQuery ( workspaceId , {
920- enabled : isSearchModalOpen && ! permissionConfig . hideKnowledgeBaseTab ,
921- } )
922-
923- const searchModalTables = useMemo (
924- ( ) =>
925- permissionConfig . hideTablesTab
926- ? [ ]
927- : fetchedTables . map ( ( t ) => ( {
928- id : t . id ,
929- name : t . name ,
930- href : `/workspace/${ workspaceId } /tables/${ t . id } ` ,
931- folderPath : getFolderPathNames ( tableFolderMap , t . folderId ) ,
932- } ) ) ,
933- [ fetchedTables , tableFolderMap , workspaceId , permissionConfig . hideTablesTab ]
934- )
935-
936- const searchModalFiles = useMemo (
937- ( ) =>
938- permissionConfig . hideFilesTab
939- ? [ ]
940- : fetchedFiles . map ( ( f ) => ( {
941- id : f . id ,
942- name : f . name ,
943- href : `/workspace/${ workspaceId } /files/${ f . id } ` ,
944- folderPath : f . folderPath
945- ? parseWorkspaceFileFolderDisplayPath ( f . folderPath )
946- : undefined ,
947- } ) ) ,
948- [ fetchedFiles , workspaceId , permissionConfig . hideFilesTab ]
949- )
950-
951- const searchModalKnowledgeBases = useMemo (
952- ( ) =>
953- permissionConfig . hideKnowledgeBaseTab
954- ? [ ]
955- : fetchedKnowledgeBases . map ( ( kb ) => ( {
956- id : kb . id ,
957- name : kb . name ,
958- href : `/workspace/${ workspaceId } /knowledge/${ kb . id } ` ,
959- folderPath : getFolderPathNames ( knowledgeBaseFolderMap , kb . folderId ) ,
960- } ) ) ,
961- [
962- fetchedKnowledgeBases ,
963- knowledgeBaseFolderMap ,
964- workspaceId ,
965- permissionConfig . hideKnowledgeBaseTab ,
966- ]
967- )
968-
969892 const chatIds = useMemo ( ( ) => chats . map ( ( t ) => t . id ) , [ chats ] )
970893
971894 const { selectedChats, handleChatClick } = useChatSelection ( { chatIds } )
@@ -1941,9 +1864,6 @@ export const Sidebar = memo(function Sidebar({
19411864 workflows = { searchModalWorkflows }
19421865 workspaces = { searchModalWorkspaces }
19431866 chats = { chats }
1944- tables = { searchModalTables }
1945- files = { searchModalFiles }
1946- knowledgeBases = { searchModalKnowledgeBases }
19471867 logs = { searchModalLogs }
19481868 integrations = { searchModalIntegrations }
19491869 connectedAccounts = { searchModalConnectedAccounts }
0 commit comments