mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
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:
@@ -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,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user