fix: skip skeleton when SWR has cached data + lazy-load Map and Globe

This commit is contained in:
Usman Baig
2026-03-10 00:32:07 +01:00
parent 01f6d8d065
commit 4babbc7555
2 changed files with 7 additions and 3 deletions

View File

@@ -416,7 +416,9 @@ export default function SiteDashboardPage() {
if (site?.domain) document.title = `${site.domain} | Pulse`
}, [site?.domain])
const showSkeleton = useMinimumLoading(overviewLoading)
// Skip the minimum-loading skeleton when SWR already has cached data
// (prevents the 300ms flash when navigating back to the dashboard)
const showSkeleton = useMinimumLoading(overviewLoading && !overview)
if (showSkeleton) {
return <DashboardSkeleton />

View File

@@ -1,14 +1,16 @@
'use client'
import { useState, useEffect } from 'react'
import dynamic from 'next/dynamic'
import { motion } from 'framer-motion'
import { logger } from '@/lib/utils/logger'
import { formatNumber } from '@ciphera-net/ui'
import { useTabListKeyboard } from '@/lib/hooks/useTabListKeyboard'
import * as Flags from 'country-flag-icons/react/3x2'
import iso3166 from 'iso-3166-2'
import DottedMap from './DottedMap'
import Globe from './Globe'
const DottedMap = dynamic(() => import('./DottedMap'), { ssr: false })
const Globe = dynamic(() => import('./Globe'), { ssr: false })
import { Modal, GlobeIcon } from '@ciphera-net/ui'
import { ListSkeleton } from '@/components/skeletons'
import { ShieldCheck, Detective, Broadcast } from '@phosphor-icons/react'