diff --git a/packages/ui/src/app/pages/Forum/ForumCategory.tsx b/packages/ui/src/app/pages/Forum/ForumCategory.tsx
index 968c0e4789..fed06f054f 100644
--- a/packages/ui/src/app/pages/Forum/ForumCategory.tsx
+++ b/packages/ui/src/app/pages/Forum/ForumCategory.tsx
@@ -13,9 +13,7 @@ import { PageTitle } from '@/common/components/page/PageTitle'
import { PreviousPage } from '@/common/components/page/PreviousPage'
import { Label, TextMedium } from '@/common/components/typography'
import { useModal } from '@/common/hooks/useModal'
-import { useRefetchQueries } from '@/common/hooks/useRefetchQueries'
import { useSort } from '@/common/hooks/useSort'
-import { MILLISECONDS_PER_BLOCK } from '@/common/model/formatters'
import { ForumCategoryList } from '@/forum/components/category/ForumCategoryList'
import { ForumPageHeader } from '@/forum/components/ForumPageHeader'
import { ThreadFilters } from '@/forum/components/threads/ThreadFilters'
@@ -48,17 +46,9 @@ export const ForumCategory = () => {
},
{ perPage: THREADS_PER_PAGE, page }
)
- const isRefetched = useRefetchQueries({
- interval: MILLISECONDS_PER_BLOCK,
- include: ['GetForumThreads', 'GetForumThreadsCount'],
- })
const { showModal } = useModal()
- if (isLoadingThreads && !isRefetched) {
- return
- }
-
if (isLoadingCategory) {
return
}
@@ -126,7 +116,7 @@ export const ForumCategory = () => {
(options.order)],
@@ -42,15 +43,17 @@ export const useForumCategoryThreads = (
offset: (pagination.page - 1) * pagination.perPage,
}),
},
+ pollInterval: isArchive === false ? MILLISECONDS_PER_BLOCK : 0,
})
- const { loading: loadingCount, data: countData } = useGetForumThreadsCountQuery({
+ const { data: countData } = useGetForumThreadsCountQuery({
variables: { where: where(filters, categoryId, isArchive) },
+ pollInterval: isArchive === false ? MILLISECONDS_PER_BLOCK : 0,
})
const totalCount = countData?.forumThreadsConnection.totalCount
return {
- isLoading: loadingThreads || loadingCount,
+ isLoading: !threadsData || !countData,
threads: threadsData?.forumThreads.map((thread) => asForumThread(thread)) ?? [],
threadCount: totalCount,
refresh,
diff --git a/packages/ui/test/forum/hooks/useForumCategoryThreads.test.ts b/packages/ui/test/forum/hooks/useForumCategoryThreads.test.ts
index 3587009ccc..28f46a3eaf 100644
--- a/packages/ui/test/forum/hooks/useForumCategoryThreads.test.ts
+++ b/packages/ui/test/forum/hooks/useForumCategoryThreads.test.ts
@@ -44,6 +44,7 @@ describe('useForumCategoryThreads', () => {
orderBy: [IsStickyDesc, UpdatedAtDesc],
limit: 30,
},
+ pollInterval: 0,
})
})
@@ -64,6 +65,7 @@ describe('useForumCategoryThreads', () => {
orderBy: [IsStickyDesc, UpdatedAtDesc],
limit: 30,
},
+ pollInterval: 0,
})
act(() => refresh({ filters: { author, date: { start, end }, tag: null } }))
@@ -82,6 +84,7 @@ describe('useForumCategoryThreads', () => {
orderBy: [IsStickyDesc, UpdatedAtDesc],
limit: 30,
},
+ pollInterval: 0,
})
})
@@ -94,6 +97,7 @@ describe('useForumCategoryThreads', () => {
orderBy: [IsStickyDesc, AuthorDesc],
limit: 30,
},
+ pollInterval: 0,
})
})
@@ -111,6 +115,7 @@ describe('useForumCategoryThreads', () => {
orderBy: [IsStickyDesc, UpdatedAtDesc],
limit: 30,
},
+ pollInterval: 0,
})
act(() => rerender([{ isArchive: true, order, filters: { author: null, date: { start, end }, tag: null } }]))
@@ -126,6 +131,7 @@ describe('useForumCategoryThreads', () => {
orderBy: [IsStickyDesc, UpdatedAtDesc],
limit: 30,
},
+ pollInterval: 0,
})
})
@@ -139,6 +145,7 @@ describe('useForumCategoryThreads', () => {
limit: 10,
offset: 0,
},
+ pollInterval: 0,
})
})
})