Skip to content

Commit 82ddaf3

Browse files
authored
fix: collection and organization pages reloading on tab focus (#8415)
fix: keep collection and organization projects on screen while refetching
1 parent 0444aa6 commit 82ddaf3

2 files changed

Lines changed: 6 additions & 9 deletions

File tree

‎apps/frontend/src/pages/collection/[collection].vue‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -620,24 +620,22 @@ const creatorHasPublicProjects = computed(
620620
const {
621621
data: followedProjects,
622622
refetch: refetchFollowedProjects,
623-
isFetching: followedProjectsIsFetching,
623+
isLoading: followedProjectsIsLoading,
624624
} = useQuery({
625625
queryKey: computed(() => ['user', auth.value.user?.id, 'follows']),
626626
queryFn: async () => fetchFollowedProjects(auth.value.user.id),
627627
enabled: computed(() => isFollowingCollection.value && !!auth.value.user?.id),
628-
placeholderData: [],
629628
})
630629
631630
// Query for collection projects
632631
const {
633632
data: collectionProjects,
634633
refetch: refetchCollectionProjects,
635-
isFetching: collectionProjectsIsFetching,
634+
isLoading: collectionProjectsIsLoading,
636635
} = useQuery({
637636
queryKey: computed(() => ['projects', collection.value?.projects]),
638637
queryFn: () => fetchProjectsByIds(collection.value.projects),
639638
enabled: computed(() => !isFollowingCollection.value && !!collection.value?.projects?.length),
640-
placeholderData: [],
641639
})
642640
643641
// Unified projects ref
@@ -650,9 +648,9 @@ const isLoading = computed(() => {
650648
if (!import.meta.client) return false
651649
652650
if (isFollowingCollection.value) {
653-
return followedProjectsIsFetching.value
651+
return followedProjectsIsLoading.value
654652
}
655-
return collectionIsPending.value || creatorIsPending.value || collectionProjectsIsFetching.value
653+
return collectionIsPending.value || creatorIsPending.value || collectionProjectsIsLoading.value
656654
})
657655
658656
onServerPrefetch(async () => {

‎apps/frontend/src/pages/organization/[organization].vue‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,11 +267,10 @@ watch(
267267
const {
268268
data: projects,
269269
refetch: refreshProjects,
270-
isFetching: projectsIsFetching,
270+
isLoading: projectsIsLoading,
271271
} = useQuery({
272272
queryKey: computed(() => ['organization', orgId, 'projects']),
273273
queryFn: () => client.labrinth.organizations_v3.getProjects(orgId),
274-
placeholderData: [],
275274
})
276275
277276
watch(
@@ -288,7 +287,7 @@ const refresh = async () => {
288287
289288
// Loading state
290289
const isLoading = computed(() => {
291-
return organizationIsPending.value || projectsIsFetching.value
290+
return organizationIsPending.value || projectsIsLoading.value
292291
})
293292
294293
// Filter accepted, sort by role, then by name and Owner role always goes first

0 commit comments

Comments
 (0)