diff --git a/packages/ui/src/app/pages/Forum/ForumCategory.tsx b/packages/ui/src/app/pages/Forum/ForumCategory.tsx index 26264abe09..968c0e4789 100644 --- a/packages/ui/src/app/pages/Forum/ForumCategory.tsx +++ b/packages/ui/src/app/pages/Forum/ForumCategory.tsx @@ -33,7 +33,7 @@ export const ForumCategory = () => { const { id, type } = useParams<{ id: string; type?: 'archive' }>() const isArchive = type === 'archive' - const { category } = useForumCategory(id) + const { category, isLoading: isLoadingCategory, hasError } = useForumCategory(id) const { order, getSortProps } = useSort('updatedAt') const { isLoading: isLoadingThreads, @@ -59,6 +59,14 @@ export const ForumCategory = () => { return } + if (isLoadingCategory) { + return + } + + if (hasError) { + return + } + if (!category) { return } diff --git a/packages/ui/src/forum/hooks/useForumCategory.ts b/packages/ui/src/forum/hooks/useForumCategory.ts index 2d557aa3a2..c43789b61f 100644 --- a/packages/ui/src/forum/hooks/useForumCategory.ts +++ b/packages/ui/src/forum/hooks/useForumCategory.ts @@ -2,10 +2,10 @@ import { useGetForumCategoryQuery } from '@/forum/queries' import { asCategoryWithDetails } from '@/forum/types/ForumCategoryWithDetails' export const useForumCategory = (id: string) => { - const { loading, data } = useGetForumCategoryQuery({ variables: { where: { id } } }) - + const { loading, data, error } = useGetForumCategoryQuery({ variables: { where: { id } } }) return { isLoading: loading, category: data?.forumCategoryByUniqueInput && asCategoryWithDetails(data.forumCategoryByUniqueInput), + hasError: !!error, } }