Skip to content

Commit

Permalink
Fix for allowed webs count
Browse files Browse the repository at this point in the history
  • Loading branch information
DinerIsmail committed Oct 13, 2024
1 parent 52b3d5c commit 679eba7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
7 changes: 6 additions & 1 deletion app/admin/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,12 @@ export default function AdminPage() {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [firstTime])

if (isLoadingWebs || isLoadingListings || isLoadingAllowedWebs) {
if (
isLoadingWebs ||
isLoadingListings ||
isLoadingAllowedWebs ||
allowedWebs === null
) {
return (
<Center height="50vh">
<Spinner size="xl" />
Expand Down
2 changes: 1 addition & 1 deletion hooks/webs/useAllowedWebs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const useAllowedWebs = () => {

const allAllowedWebs = useMemo(() => {
if (!webs || !permissions) {
return []
return null
}

const allowedWebs = session?.user.admin
Expand Down
3 changes: 1 addition & 2 deletions hooks/webs/useCreateWeb.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ async function createWebRequest(webData): Promise<{ web: Web }> {

export default function useCreateWeb() {
const queryClient = useQueryClient()

const { data, isPending, isSuccess, isError, error, mutate } = useMutation({
mutationFn: createWebRequest,
onMutate: (newWeb) => {
Expand All @@ -30,7 +29,7 @@ export default function useCreateWeb() {
])
return { previousWebs, newWeb }
},
onSuccess: (data, variables, context) => {
onSuccess: (data, _variables, context) => {
queryClient.setQueryData(
['webs', { withAdminInfo: false }],
[...(context.previousWebs as Web[]), data.web],
Expand Down

0 comments on commit 679eba7

Please sign in to comment.