mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-25 00:36:31 +02:00
Merge pull request #1113 from SohamBhattacharjee2003/perf/optimize-threads-query
perf: normalize query keys and add placeholderData to optimize…
This commit is contained in:
commit
183169a37a
2 changed files with 3 additions and 2 deletions
|
|
@ -109,6 +109,7 @@ export function AllPrivateChatsSidebarContent({
|
||||||
queryKey: ["all-threads", searchSpaceId],
|
queryKey: ["all-threads", searchSpaceId],
|
||||||
queryFn: () => fetchThreads(Number(searchSpaceId)),
|
queryFn: () => fetchThreads(Number(searchSpaceId)),
|
||||||
enabled: !!searchSpaceId && !isSearchMode,
|
enabled: !!searchSpaceId && !isSearchMode,
|
||||||
|
placeholderData: () => queryClient.getQueryData(["threads", searchSpaceId, { limit: 40 }]),
|
||||||
});
|
});
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
|
|
||||||
|
|
@ -440,8 +440,8 @@ export function OnboardingTour() {
|
||||||
|
|
||||||
// Fetch threads data
|
// Fetch threads data
|
||||||
const { data: threadsData } = useQuery({
|
const { data: threadsData } = useQuery({
|
||||||
queryKey: ["threads", searchSpaceId, { limit: 1 }],
|
queryKey: ["threads", searchSpaceId, { limit: 40 }], // Same key as layout
|
||||||
queryFn: () => fetchThreads(Number(searchSpaceId), 1), // Only need to check if any exist
|
queryFn: () => fetchThreads(Number(searchSpaceId), 40),
|
||||||
enabled: !!searchSpaceId,
|
enabled: !!searchSpaceId,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue