Skip to content

Commit

Permalink
fix: return null if collection is undefined in LoggedInHeaderActions.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
ekraffmiller committed Nov 2, 2024
1 parent f035c26 commit cd025bb
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/sections/layout/header/LoggedInHeaderActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { User } from '../../../users/domain/models/User'
import { CollectionRepository } from '../../../collection/domain/repositories/CollectionRepository'
import { AccountHelper } from '../../account/AccountHelper'
import { useCollection } from '@/sections/collection/useCollection'
import { PageNotFound } from '@/sections/page-not-found/PageNotFound'

const currentPage = 0

Expand All @@ -24,7 +23,7 @@ export const LoggedInHeaderActions = ({
const { t } = useTranslation('header')
const { logout } = useSession()
const navigate = useNavigate()
const { collection, isLoading } = useCollection(collectionRepository)
const { collection } = useCollection(collectionRepository)

const { collectionUserPermissions } = useGetCollectionUserPermissions({
collectionIdOrAlias: undefined,
Expand All @@ -37,11 +36,7 @@ export const LoggedInHeaderActions = ({
})
}

if (!isLoading && !collection) {
return <PageNotFound />
}

if (isLoading || !collection) {
if (!collection) {
return null
}

Expand Down

0 comments on commit cd025bb

Please sign in to comment.