Downgraded nuxt to prevent supabase errors

The issues would happen randomly when login from google, it doesn't seem to happen again with nuxt 3.7.0 ?
This commit is contained in:
Alexis
2024-05-13 22:10:48 +02:00
parent 133404ff72
commit da6b30f00c
5 changed files with 28 additions and 19 deletions

3
.npmrc Normal file
View File

@@ -0,0 +1,3 @@
# https://pnpm.io/npmrc#shamefully-hoist
# Fixes: WARN Failed to resolve dependency: @supabase/gotrue-js, present in 'optimizeDeps.include'
shamefully-hoist=true

View File

@@ -31,6 +31,8 @@ const useIdFunction = () => useId()
<template> <template>
<div class="h-screen"> <div class="h-screen">
<NuxtLoadingIndicator />
<NuxtLayout> <NuxtLayout>
<ConfigProvider :use-id="useIdFunction"> <ConfigProvider :use-id="useIdFunction">
<NuxtPage/> <NuxtPage/>

View File

@@ -8,7 +8,13 @@ const router = useRouter()
const { auth } = useSupabaseClient() const { auth } = useSupabaseClient()
const user = useSupabaseUser() const user = useSupabaseUser()
const userMeta = computed(() => user.value?.user_metadata) const userMeta = computed(() => user.value?.user_metadata)
const hasSession = computed(() => Boolean(user.value))
const menuOpened = ref<boolean>(false)
function closeMenu() {
menuOpened.value = false
}
watch(user, closeMenu)
async function handleGoogleLogin() { async function handleGoogleLogin() {
try { try {
@@ -43,9 +49,9 @@ function gotoProfilePage() {
<template> <template>
<ClientOnly> <ClientOnly>
<UiPopover> <UiPopover v-model:open="menuOpened">
<UiPopoverTrigger :as-child="hasSession"> <UiPopoverTrigger>
<UiAvatar v-if="hasSession" class="cursor-pointer"> <UiAvatar v-if="user" class="cursor-pointer">
<UiAvatarImage <UiAvatarImage
:src="userMeta?.avatar_url" :src="userMeta?.avatar_url"
:alt="userMeta?.full_name" :alt="userMeta?.full_name"
@@ -58,19 +64,17 @@ function gotoProfilePage() {
</UiButton> </UiButton>
</UiPopoverTrigger> </UiPopoverTrigger>
<UiPopoverContent class="w-fit p-0" :align="'start'" :side="'top'" :collision-padding="20"> <UiPopoverContent class="w-fit p-0" :align="'start'" :side="'top'" :collision-padding="20">
<div id="user-popover"> <UiCommand>
<UiCommand> <UiCommandList v-if="user">
<UiCommandList v-if="user"> <UiCommandGroup :heading="`Connecté en tant que ${user?.email}`">
<UiCommandGroup :heading="`Connecté en tant que ${user?.email}`"> <UiCommandItem value="profile" @select="gotoProfilePage"> Profil </UiCommandItem>
<UiCommandItem value="profile" @select="gotoProfilePage"> Profil </UiCommandItem> <UiCommandItem value="logout" @select="handleLogout"> Déconnexion </UiCommandItem>
<UiCommandItem value="logout" @select="handleLogout"> Déconnexion </UiCommandItem> </UiCommandGroup>
</UiCommandGroup> </UiCommandList>
</UiCommandList> <UiCommandList v-else>
<UiCommandList v-else> <UiCommandItem value="logout" @select="handleGoogleLogin"> Connexion </UiCommandItem>
<UiCommandItem value="logout" @select="handleGoogleLogin"> Connexion </UiCommandItem> </UiCommandList>
</UiCommandList> </UiCommand>
</UiCommand>
</div>
</UiPopoverContent> </UiPopoverContent>
</UiPopover> </UiPopover>
</ClientOnly> </ClientOnly>

View File

@@ -21,7 +21,7 @@
"class-variance-authority": "^0.7.0", "class-variance-authority": "^0.7.0",
"clsx": "^2.1.1", "clsx": "^2.1.1",
"lucide-vue-next": "^0.364.0", "lucide-vue-next": "^0.364.0",
"nuxt": "^3.11.2", "nuxt": "^3.7.0",
"pinia": "^2.1.7", "pinia": "^2.1.7",
"radix-vue": "^1.7.4", "radix-vue": "^1.7.4",
"shadcn-nuxt": "^0.10.4", "shadcn-nuxt": "^0.10.4",

2
pnpm-lock.yaml generated
View File

@@ -33,7 +33,7 @@ importers:
specifier: ^0.364.0 specifier: ^0.364.0
version: 0.364.0(vue@3.4.27(typescript@5.4.5)) version: 0.364.0(vue@3.4.27(typescript@5.4.5))
nuxt: nuxt:
specifier: ^3.11.2 specifier: ^3.7.0
version: 3.11.2(@opentelemetry/api@1.8.0)(@parcel/watcher@2.4.1)(@types/node@20.12.11)(@unocss/reset@0.60.2)(encoding@0.1.13)(eslint@8.57.0)(floating-vue@5.2.2(@nuxt/kit@3.11.2(rollup@4.17.2))(vue@3.4.27(typescript@5.4.5)))(ioredis@5.4.1)(optionator@0.9.4)(rollup@4.17.2)(sass@1.77.1)(terser@5.31.0)(typescript@5.4.5)(unocss@0.60.2(postcss@8.4.38)(rollup@4.17.2)(vite@5.2.11(@types/node@20.12.11)(sass@1.77.1)(terser@5.31.0)))(vite@5.2.11(@types/node@20.12.11)(sass@1.77.1)(terser@5.31.0)) version: 3.11.2(@opentelemetry/api@1.8.0)(@parcel/watcher@2.4.1)(@types/node@20.12.11)(@unocss/reset@0.60.2)(encoding@0.1.13)(eslint@8.57.0)(floating-vue@5.2.2(@nuxt/kit@3.11.2(rollup@4.17.2))(vue@3.4.27(typescript@5.4.5)))(ioredis@5.4.1)(optionator@0.9.4)(rollup@4.17.2)(sass@1.77.1)(terser@5.31.0)(typescript@5.4.5)(unocss@0.60.2(postcss@8.4.38)(rollup@4.17.2)(vite@5.2.11(@types/node@20.12.11)(sass@1.77.1)(terser@5.31.0)))(vite@5.2.11(@types/node@20.12.11)(sass@1.77.1)(terser@5.31.0))
pinia: pinia:
specifier: ^2.1.7 specifier: ^2.1.7