Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

fix:#17512

Yashdfcaebcdc9d8
diff --git a/apps/www/components/Nav/index.tsx b/apps/www/components/Nav/index.tsx
index b36fd57c9dd..5b321c0318a 100644
--- a/apps/www/components/Nav/index.tsx
+++ b/apps/www/components/Nav/index.tsx
@@ -13,7 +13,7 @@ import Developers from '~/components/Nav/Developers'
import ScrollProgress from '~/components/ScrollProgress'
-import { useIsLoggedIn, useTheme } from 'common'
+import { useIsLoggedIn, useIsUserLoading, useTheme } from 'common'
import TextLink from '../TextLink'
import Image from 'next/image'
import * as supabaseLogoWordmarkDark from 'common/assets/images/supabase-logo-wordmark--dark.png'
@@ -26,7 +26,9 @@ const Nav = () => {
const [openProduct, setOpenProduct] = useState(false)
const [openDevelopers, setOpenDevelopers] = useState(false)
const isLoggedIn = useIsLoggedIn()
-
+ const isUserLoading = useIsUserLoading()
+
+
const isHomePage = router.pathname === '/'
const isLaunchWeekPage = router.pathname.includes('launch-week')
const showLaunchWeekNavMode =
@@ -290,62 +292,66 @@ const Nav = () => {
</div>
</div>
<div className="flex items-center gap-2">
- <a href="https://github.com/supabase/supabase" target="_blank">
- <Button
- className="hidden group lg:flex"
- type="text"
- icon={
- <div className="flex items-center justify-center w-4 h-4 text-brand-300">
- <div
- className={[
- `text-scale-900 flex h-3 w-3 items-center justify-center
+ {
+ (!isUserLoading) && <>
+ <a href="https://github.com/supabase/supabase" target="_blank">
+ <Button
+ className="hidden group lg:flex"
+ type="text"
+ icon={
+ <div className="flex items-center justify-center w-4 h-4 text-brand-300">
+ <div
+ className={[
+ `text-scale-900 flex h-3 w-3 items-center justify-center
- transition-all
- group-hover:h-4
- group-hover:w-4
- group-hover:text-yellow-900
- group-focus:h-4
- group-focus:w-4
+ transition-all
+ group-hover:h-4
+ group-hover:w-4
+ group-hover:text-yellow-900
+ group-focus:h-4
+ group-focus:w-4
- group-focus:text-yellow-900`,
- showLaunchWeekNavMode && '!text-white',
- ].join(' ')}
- >
- <IconStar strokeWidth={2} />
+ group-focus:text-yellow-900`,
+ showLaunchWeekNavMode && '!text-white',
+ ].join(' ')}
+ >
+ <IconStar strokeWidth={2} />
+ </div>
</div>
- </div>
- }
- >
- <span
- // className={isLaunchWeekPage ? '!text-white' : ''}
+ }
>
- Star us on GitHub
- </span>
- </Button>
- </a>
+ <span
+ // className={isLaunchWeekPage ? '!text-white' : ''}
+ >
+ Star us on GitHub
+ </span>
+ </Button>
+ </a>
- {isLoggedIn ? (
- <Link href="/dashboard/projects">
- <a>
- <Button className="hidden text-white lg:block">Dashboard</Button>
- </a>
- </Link>
- ) : (
- <>
- <Link href="https://supabase.com/dashboard">
+ {isLoggedIn ? (
+ <Link href="/dashboard/projects">
<a>
- <Button type="default" className="hidden lg:block">
- Sign in
- </Button>
- </a>
- </Link>
- <Link href="https://supabase.com/dashboard">
- <a>
- <Button className="hidden text-white lg:block">Start your project</Button>
+ <Button className="hidden text-white lg:block">Dashboard</Button>
</a>
</Link>
+ ) : (
+ <>
+ <Link href="https://supabase.com/dashboard">
+ <a>
+ <Button type="default" className="hidden lg:block">
+ Sign in
+ </Button>
+ </a>
+ </Link>
+ <Link href="https://supabase.com/dashboard">
+ <a>
+ <Button className="hidden text-white lg:block">Start your project</Button>
+ </a>
+ </Link>
+ </>
+ )}
</>
- )}
+ }
</div>
</div>
</div>
diff --git a/packages/common/auth.tsx b/packages/common/auth.tsx
index 9529f3cbe8c..4d5a943ab9d 100644
--- a/packages/common/auth.tsx
+++ b/packages/common/auth.tsx
@@ -103,6 +103,8 @@ export const useSession = () => useAuth().session
export const useUser = () => useSession()?.user ?? null
+export const useIsUserLoading = () => useAuth().isLoading
+
export const useIsLoggedIn = () => {
const user = useUser()