mirror of
https://github.com/MODSetter/SurfSense
synced 2026-06-21 13:44:09 +00:00
perf(hooks): normalize query keys and add placeholderData to optimize thread loading
This commit is contained in:
@@ -109,6 +109,7 @@ export function AllPrivateChatsSidebarContent({
|
||||
queryKey: ["all-threads", searchSpaceId],
|
||||
queryFn: () => fetchThreads(Number(searchSpaceId)),
|
||||
enabled: !!searchSpaceId && !isSearchMode,
|
||||
placeholderData: () => queryClient.getQueryData(["threads", searchSpaceId, { limit: 40 }]),
|
||||
});
|
||||
|
||||
const {
|
||||
|
||||
@@ -439,8 +439,8 @@ export function OnboardingTour() {
|
||||
|
||||
// Fetch threads data
|
||||
const { data: threadsData } = useQuery({
|
||||
queryKey: ["threads", searchSpaceId, { limit: 1 }],
|
||||
queryFn: () => fetchThreads(Number(searchSpaceId), 1), // Only need to check if any exist
|
||||
queryKey: ["threads", searchSpaceId, { limit: 40 }], // Same key as layout
|
||||
queryFn: () => fetchThreads(Number(searchSpaceId), 40),
|
||||
enabled: !!searchSpaceId,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user