mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-08 22:22:17 +02:00
refactor(onboarding-tour, layout, sidebar): reduce thread fetch limit to 6 for improved performance
- Updated thread fetching logic across multiple components to limit the number of threads fetched to 6 instead of 40. - Adjusted related placeholder data and chat display logic in the sidebar to reflect the new limit.
This commit is contained in:
parent
1c9ab207ef
commit
34c8b4aa86
4 changed files with 7 additions and 7 deletions
|
|
@ -118,10 +118,10 @@ export function LayoutDataProvider({ workspaceId, children }: LayoutDataProvider
|
|||
enabled: !!workspaceId,
|
||||
});
|
||||
|
||||
// Fetch threads (40 total to allow up to 20 per section - shared/private)
|
||||
// Fetch recent threads for the sidebar.
|
||||
const { data: threadsData, isPending: isLoadingThreads } = useQuery({
|
||||
queryKey: ["threads", workspaceId, { limit: 40 }],
|
||||
queryFn: () => fetchThreads(Number(workspaceId), 40),
|
||||
queryKey: ["threads", workspaceId, { limit: 6 }],
|
||||
queryFn: () => fetchThreads(Number(workspaceId), 6),
|
||||
enabled: !!workspaceId,
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ function AllChatsContent({ workspaceId, className }: AllChatsContentProps) {
|
|||
queryKey: ["all-threads", workspaceId],
|
||||
queryFn: () => fetchThreads(Number(workspaceId)),
|
||||
enabled: !!workspaceId && !isSearchMode,
|
||||
placeholderData: () => queryClient.getQueryData(["threads", workspaceId, { limit: 40 }]),
|
||||
placeholderData: () => queryClient.getQueryData(["threads", workspaceId, { limit: 6 }]),
|
||||
});
|
||||
|
||||
const {
|
||||
|
|
|
|||
|
|
@ -311,7 +311,7 @@ export function Sidebar({
|
|||
) : chats.length > 0 ? (
|
||||
<div className="relative">
|
||||
<div className={`flex flex-col gap-0.5 ${chats.length > 4 ? "pb-2" : ""}`}>
|
||||
{chats.slice(0, 20).map((chat) => (
|
||||
{chats.slice(0, 6).map((chat) => (
|
||||
<ChatListItem
|
||||
key={chat.id}
|
||||
name={chat.name}
|
||||
|
|
|
|||
|
|
@ -395,8 +395,8 @@ export function OnboardingTour() {
|
|||
|
||||
// Fetch threads data
|
||||
const { data: threadsData } = useQuery({
|
||||
queryKey: ["threads", workspaceId, { limit: 40 }], // Same key as layout
|
||||
queryFn: () => fetchThreads(Number(workspaceId), 40),
|
||||
queryKey: ["threads", workspaceId, { limit: 6 }], // Same key as layout
|
||||
queryFn: () => fetchThreads(Number(workspaceId), 6),
|
||||
enabled: !!workspaceId,
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue