Updated Goal loading.

This commit is contained in:
Mike Cao 2025-06-18 20:12:42 -07:00
parent f444c6373d
commit 96fcdefeed

View file

@ -24,7 +24,7 @@ export type GoalData = { num: number; total: number };
export function Goal({ id, name, type, parameters, websiteId, startDate, endDate }: GoalProps) { export function Goal({ id, name, type, parameters, websiteId, startDate, endDate }: GoalProps) {
const { formatMessage, labels } = useMessages(); const { formatMessage, labels } = useMessages();
const { data, error, isLoading } = useResultQuery<GoalData>(type, { const { data, error, isLoading, isFetching } = useResultQuery<GoalData>(type, {
websiteId, websiteId,
dateRange: { dateRange: {
startDate, startDate,
@ -35,7 +35,8 @@ export function Goal({ id, name, type, parameters, websiteId, startDate, endDate
const isPage = parameters?.type === 'page'; const isPage = parameters?.type === 'page';
return ( return (
<LoadingPanel data={data} isLoading={isLoading} error={error}> <LoadingPanel data={data} isLoading={isLoading} isFetching={isFetching} error={error}>
{data && (
<Grid gap> <Grid gap>
<Grid columns="1fr auto" gap> <Grid columns="1fr auto" gap>
<Column gap> <Column gap>
@ -93,6 +94,7 @@ export function Goal({ id, name, type, parameters, websiteId, startDate, endDate
</Text> </Text>
</Row> </Row>
</Grid> </Grid>
)}
</LoadingPanel> </LoadingPanel>
); );
} }