diff --git a/app/admin/page.tsx b/app/admin/page.tsx index 7f6f5ac..9f21d61 100644 --- a/app/admin/page.tsx +++ b/app/admin/page.tsx @@ -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 (
diff --git a/hooks/webs/useAllowedWebs.tsx b/hooks/webs/useAllowedWebs.tsx index 25dcead..4cee221 100644 --- a/hooks/webs/useAllowedWebs.tsx +++ b/hooks/webs/useAllowedWebs.tsx @@ -28,7 +28,7 @@ const useAllowedWebs = () => { const allAllowedWebs = useMemo(() => { if (!webs || !permissions) { - return [] + return null } const allowedWebs = session?.user.admin diff --git a/hooks/webs/useCreateWeb.tsx b/hooks/webs/useCreateWeb.tsx index 226a708..daf2ea7 100644 --- a/hooks/webs/useCreateWeb.tsx +++ b/hooks/webs/useCreateWeb.tsx @@ -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) => { @@ -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],