π Open source, privacy-first web analytics β a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!
TypeScript chartsclickhousedockergdprgoogle-analyticsmetricsmonitoringmysqlnestjsprivacyredisself-hostedselfhostedstatisticstailwindcssweb-analyticswebanalyticswebsite
fix: Missing panel loading indicators
Blue Mouseea5c433ff85f
diff --git a/web/app/pages/Project/tabs/Errors/ErrorChart.tsx b/web/app/pages/Project/tabs/Errors/ErrorChart.tsxindex 8a26dbdd9..c376a9fff 100644--- a/web/app/pages/Project/tabs/Errors/ErrorChart.tsx+++ b/web/app/pages/Project/tabs/Errors/ErrorChart.tsx@@ -8,6 +8,7 @@ import type { ChartDataPointClick } from '~/pages/Project/View/utils/chartPoint'import { MetricCard } from '~/pages/Project/tabs/Traffic/MetricCards'import { MainChart } from '../../View/components/MainChart'+import { RefetchIndicator } from '../../View/v2/loading'import { getSettingsError } from '../../View/ViewProject.helpers'interface ErrorChartStat {@@ -32,6 +33,7 @@ interface ErrorChartProps {annotations?: Annotation[]stats?: ErrorChartStat[]onDataPointClick?: ChartDataPointClick+ isRefetching?: boolean}export const ErrorChart = ({@@ -45,6 +47,7 @@ export const ErrorChart = ({annotations,stats,onDataPointClick,+ isRefetching,}: ErrorChartProps) => {const { t } = useTranslation('common')@@ -117,7 +120,8 @@ export const ErrorChart = ({if (!options && !hasStats) return nullreturn (- <div className='overflow-hidden rounded-lg border border-gray-200 bg-white p-4 dark:border-slate-800/60 dark:bg-slate-900/25'>+ <div className='relative overflow-hidden rounded-lg border border-gray-200 bg-white p-4 dark:border-slate-800/60 dark:bg-slate-900/25'>+ {isRefetching ? <RefetchIndicator /> : null}{hasStats ? (<div className='mb-5 flex flex-wrap justify-center gap-5 lg:justify-start'>{stats!.map((stat) => (diff --git a/web/app/pages/Project/tabs/Errors/ErrorsView.tsx b/web/app/pages/Project/tabs/Errors/ErrorsView.tsxindex fc124469c..3356385de 100644--- a/web/app/pages/Project/tabs/Errors/ErrorsView.tsx+++ b/web/app/pages/Project/tabs/Errors/ErrorsView.tsx@@ -1106,8 +1106,7 @@ const ErrorsViewInner = () => {) : null}{activeError?.details ? (- <div className='relative'>- {detailsRefetching ? <RefetchIndicator /> : null}+ <div><ErrorDetailsdetails={activeError.details}chart={@@ -1119,6 +1118,7 @@ const ErrorsViewInner = () => {chartType={chartTypes.line}dataNames={dataNames}onDataPointClick={handleActiveErrorDataPointClick}+ isRefetching={detailsRefetching}stats={[{key: 'occurrences',diff --git a/web/app/pages/Project/tabs/Performance/PerformanceView.tsx b/web/app/pages/Project/tabs/Performance/PerformanceView.tsxindex fa89c731c..c0972cd6c 100644--- a/web/app/pages/Project/tabs/Performance/PerformanceView.tsx+++ b/web/app/pages/Project/tabs/Performance/PerformanceView.tsx@@ -36,6 +36,7 @@ import {BreakdownPanel,BreakdownSubTab,} from '~/pages/Project/View/v2/BreakdownPanel'+import { RefetchIndicator } from '~/pages/Project/View/v2/loading'import { useViewProjectContext } from '~/pages/Project/View/ViewProject'import {panelIconMapping,@@ -207,6 +208,12 @@ const PerformanceViewInner = ({ tnMapping }: PerformanceViewProps) => {// ever means "nothing cached to show yet" β exactly when a spinner is wanted.const isChartLoading = summaryQuery.isLoading || timeseriesQuery.isLoading+ // The counterpart: stale data is on screen while a refresh is in flight, so+ // the panel gets the same progress bar the breakdown panels use.+ const isChartRefetching =+ (summaryQuery.isFetching && !summaryQuery.isLoading) ||+ (timeseriesQuery.isFetching && !timeseriesQuery.isLoading)+const handleDataPointClick = useCallback((d: { x: Date; index: number; xValue?: string }) => {setSessionsDrawer(@@ -497,6 +504,7 @@ const PerformanceViewInner = ({ tnMapping }: PerformanceViewProps) => {<Filters className='mb-3' tnMapping={tnMapping} />) : null}<div className='relative overflow-hidden rounded-lg border border-gray-200 bg-white p-4 dark:border-slate-800/60 dark:bg-slate-900/25'>+ {isChartRefetching ? <RefetchIndicator /> : null}<div className='mb-3 flex w-full items-center justify-end gap-1.5 lg:absolute lg:top-2 lg:right-2 lg:mb-0 lg:w-auto lg:justify-normal'><Dropdownitems={chartMetrics}diff --git a/web/app/pages/Project/tabs/SEO/CompactReferralPanel.tsx b/web/app/pages/Project/tabs/SEO/CompactReferralPanel.tsxindex d77568328..13b39a46c 100644--- a/web/app/pages/Project/tabs/SEO/CompactReferralPanel.tsx+++ b/web/app/pages/Project/tabs/SEO/CompactReferralPanel.tsx@@ -5,6 +5,7 @@ import { useTranslation } from 'react-i18next'import type { Entry } from '~/lib/models/Entry'import { PanelEmptyState, PanelLoadingState } from '~/pages/Project/View/Panels'+import { RefetchIndicator } from '~/pages/Project/View/v2/loading'import { Text } from '~/ui/Text'import { nFormatter } from '~/utils/generic'@@ -17,6 +18,7 @@ interface CompactReferralPanelProps {icon: React.ReactNoderowMapper: (entry: any) => React.ReactNodeisLoading?: boolean+ isRefetching?: boolean}const CompactReferralPanel = ({@@ -25,6 +27,7 @@ const CompactReferralPanel = ({icon,rowMapper,isLoading,+ isRefetching,}: CompactReferralPanelProps) => {const { t } = useTranslation('common')const total = useMemo(() => data.reduce((sum, e) => sum + e.count, 0), [data])@@ -57,7 +60,8 @@ const CompactReferralPanel = ({if (isLoading || _isEmpty(data)) {return (- <div className='overflow-hidden rounded-lg border border-gray-200 bg-white px-4 py-3 dark:border-slate-800/60 dark:bg-slate-900/25'>+ <div className='relative overflow-hidden rounded-lg border border-gray-200 bg-white px-4 py-3 dark:border-slate-800/60 dark:bg-slate-900/25'>+ {isRefetching ? <RefetchIndicator /> : null}<div className='flex items-center gap-1 text-gray-900 dark:text-gray-50'>{icon}<Text size='sm' weight='semibold'>@@ -116,7 +120,8 @@ const CompactReferralPanel = ({}return (- <div className='overflow-hidden rounded-lg border border-gray-200 bg-white px-4 py-3 dark:border-slate-800/60 dark:bg-slate-900/25'>+ <div className='relative overflow-hidden rounded-lg border border-gray-200 bg-white px-4 py-3 dark:border-slate-800/60 dark:bg-slate-900/25'>+ {isRefetching ? <RefetchIndicator /> : null}<div className='mb-2 flex items-center justify-between'><div className='flex items-center gap-1 text-gray-900 dark:text-gray-50'>{icon}diff --git a/web/app/pages/Project/tabs/SEO/SEOView.tsx b/web/app/pages/Project/tabs/SEO/SEOView.tsxindex a5a38ac27..a7ed3cf82 100644--- a/web/app/pages/Project/tabs/SEO/SEOView.tsx+++ b/web/app/pages/Project/tabs/SEO/SEOView.tsx@@ -52,6 +52,7 @@ import {type BreakdownSubTab,} from '~/pages/Project/View/v2/BreakdownPanel'import { mapBreakdownRows } from '~/pages/Project/View/v2/adapters'+import { RefetchIndicator } from '~/pages/Project/View/v2/loading'import { useViewProjectContext } from '~/pages/Project/View/ViewProject'import {noRegionPeriods,@@ -717,6 +718,9 @@ const SEOViewInner = ({ tnMapping }: SEOViewProps) => {const isHeroLoading = summaryQuery.isPending || timeseriesQuery.isPendingconst isHeroError = summaryQuery.isError || timeseriesQuery.isError+ const isHeroRefetching =+ (summaryQuery.isFetching && !summaryQuery.isPending) ||+ (timeseriesQuery.isFetching && !timeseriesQuery.isPending)return (<>@@ -726,6 +730,7 @@ const SEOViewInner = ({ tnMapping }: SEOViewProps) => {) : null}<div className='relative overflow-hidden rounded-lg border border-gray-200 bg-white p-4 dark:border-slate-800/60 dark:bg-slate-900/25'>+ {isHeroRefetching ? <RefetchIndicator /> : null}<div className='mb-3 flex w-full items-center justify-end gap-1 lg:absolute lg:top-2 lg:right-2 lg:mb-0 lg:w-auto lg:justify-normal'><Dropdownheader={t('project.metricVis')}@@ -889,6 +894,7 @@ const SEOViewInner = ({ tnMapping }: SEOViewProps) => {icon={panelIconMapping.referrer}rowMapper={refRowMapper}isLoading={referrerQuery.isLoading}+ isRefetching={referrerQuery.isFetching && !referrerQuery.isLoading}/><CompactReferralPaneltitle={t('project.seo.aiReferrals')}@@ -896,11 +902,15 @@ const SEOViewInner = ({ tnMapping }: SEOViewProps) => {icon={<RobotIcon className='h-5 w-5' />}rowMapper={refRowMapper}isLoading={referrerQuery.isLoading}+ isRefetching={referrerQuery.isFetching && !referrerQuery.isLoading}/><divref={brandedRef}- className='overflow-hidden rounded-lg border border-gray-200 bg-white px-4 py-3 dark:border-slate-800/60 dark:bg-slate-900/25'+ className='relative overflow-hidden rounded-lg border border-gray-200 bg-white px-4 py-3 dark:border-slate-800/60 dark:bg-slate-900/25'>+ {brandedQuery.isFetching && !brandedQuery.isPending ? (+ <RefetchIndicator />+ ) : null}<div className='mb-1 flex items-center gap-1 text-gray-900 dark:text-gray-50'><MagnifyingGlassIcon className='size-5' /><Text size='sm' weight='semibold'>@@ -1040,6 +1050,7 @@ const SEOViewInner = ({ tnMapping }: SEOViewProps) => {/>}contentClassName=''+ isRefetching={quadrantQuery.isFetching && !quadrantQuery.isPending}>{quadrantQuery.isPending ? (<div className='flex h-[400px] items-center justify-center'>diff --git a/web/app/pages/Project/tabs/Traffic/TrafficView.tsx b/web/app/pages/Project/tabs/Traffic/TrafficView.tsxindex ef508a509..7b1f805fc 100644--- a/web/app/pages/Project/tabs/Traffic/TrafficView.tsx+++ b/web/app/pages/Project/tabs/Traffic/TrafficView.tsx@@ -79,6 +79,7 @@ import {pivotTrafficTimeseries,summaryToOverall,} from '~/pages/Project/View/v2/adapters'+import { RefetchIndicator } from '~/pages/Project/View/v2/loading'import { TrafficMap } from '~/pages/Project/View/v2/TrafficMap'import { useViewProjectContext } from '~/pages/Project/View/ViewProject'import {@@ -378,6 +379,12 @@ const TrafficViewInner = ({// ever means "nothing cached to show yet" β exactly when a spinner is wanted.const isChartLoading = summaryQuery.isLoading || timeseriesQuery.isLoading+ // The counterpart: stale data is on screen while a refresh is in flight, so+ // the panel gets the same progress bar the breakdown panels use.+ const isChartRefetching =+ (summaryQuery.isFetching && !summaryQuery.isLoading) ||+ (timeseriesQuery.isFetching && !timeseriesQuery.isLoading)+const isMountedRef = useRef(true)useEffect(() => {@@ -1055,6 +1062,7 @@ const TrafficViewInner = ({resetMetrics={resetCustomMetrics}/><div className='relative overflow-hidden rounded-lg border border-gray-200 bg-white p-4 dark:border-slate-800/60 dark:bg-slate-900/25'>+ {isChartRefetching ? <RefetchIndicator /> : null}<div className='mb-3 flex w-full items-center justify-end gap-1 lg:absolute lg:top-2 lg:right-2 lg:mb-0 lg:w-auto lg:justify-normal'><Dropdownheader={t('project.metricVis')}