fix(explore/stats): gate stats:lines query on stats feature flag

When no stats microservice is configured (config.features.stats.isEnabled
false), don't fire the stats:lines request that can only fail — the Stats page
already renders the live Network Overview + an honest 'being indexed' note.
Avoids a wasted erroring query on every Stats page load.
This commit is contained in:
zooqueen
2026-06-23 21:10:33 -07:00
parent 36e0db0b88
commit 67bbfef7b0
+4
View File
@@ -5,6 +5,7 @@ import type * as stats from '@luxfi/stats-types';
import type { StatsIntervalIds } from 'types/client/stats';
import type { ExternalChainExtended } from 'types/externalChains';
import config from 'configs/app';
import useApiQuery from 'lib/api/useApiQuery';
import getQueryParamString from 'lib/router/getQueryParamString';
import { STATS_CHARTS } from 'stubs/stats';
@@ -27,6 +28,9 @@ export default function useStats({ chain }: Props = {}) {
const { data, isPlaceholderData, isError } = useApiQuery('stats:lines', {
queryOptions: {
placeholderData: STATS_CHARTS,
// No stats microservice configured → don't fire a request that can only
// fail; the page renders the live Network Overview + an honest note.
enabled: config.features.stats.isEnabled,
},
chain,
});