Skip to content

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

Show loader for notebook counts (#49529)

Joshen Lim15234190f7f4
diff --git a/apps/studio/components/layouts/ExplorerLayout/ExplorerNavHome.tsx b/apps/studio/components/layouts/ExplorerLayout/ExplorerNavHome.tsx
index 2cab289d42b..547e3d3470f 100644
--- a/apps/studio/components/layouts/ExplorerLayout/ExplorerNavHome.tsx
+++ b/apps/studio/components/layouts/ExplorerLayout/ExplorerNavHome.tsx
@@ -2,6 +2,7 @@ import { useParams } from 'common'
import { motion } from 'framer-motion'
import { ChevronRight } from 'lucide-react'
import Link from 'next/link'
+import { ShimmeringLoader } from 'ui-patterns/ShimmeringLoader'
import {
EXPLORER_SECTIONS,
@@ -28,7 +29,10 @@ export const ExplorerNavHome = ({
const notebooks = notebooksData?.pages.flatMap((page) => page.content) ?? []
const chats = useAiAssistantChatList()
- const { data: notebookCountData } = useContentCountQuery({ projectRef: ref, type: 'notebook' })
+ const { data: notebookCountData, isPending } = useContentCountQuery({
+ projectRef: ref,
+ type: 'notebook',
+ })
// [Joshen] Notebooks are all shared by default, none private
const notebookCount = notebookCountData?.shared ?? 0
@@ -57,9 +61,15 @@ export const ExplorerNavHome = ({
>
<Icon size={14} className="shrink-0" />
<span className="flex-1 text-left">{label}</span>
- <span className="text-xs text-foreground-lighter">
- {type === 'notebook' ? notebookCount : chats.length}
- </span>
+ {type === 'notebook' ? (
+ isPending ? (
+ <ShimmeringLoader className="w-3 py-2" />
+ ) : (
+ <span className="text-xs text-foreground-lighter">{notebookCount}</span>
+ )
+ ) : (
+ <span className="text-xs text-foreground-lighter">{chats.length}</span>
+ )}
<ChevronRight size={14} className="shrink-0 text-foreground-muted" />
</button>
)