mirror of
https://github.com/hyperdxio/hyperdx
synced 2026-04-21 13:37:15 +00:00
fix: Allow users to disable field fetching (#1031)
This commit is contained in:
parent
8da7042ae0
commit
3bb11afbd5
3 changed files with 15 additions and 0 deletions
5
.changeset/witty-ravens-explode.md
Normal file
5
.changeset/witty-ravens-explode.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
"@hyperdx/app": patch
|
||||
---
|
||||
|
||||
fix: Allow users to disable field fetching
|
||||
|
|
@ -8,6 +8,9 @@ export const HDX_LOCAL_DEFAULT_CONNECTIONS = env(
|
|||
export const HDX_LOCAL_DEFAULT_SOURCES = env(
|
||||
'NEXT_PUBLIC_HDX_LOCAL_DEFAULT_SOURCES',
|
||||
);
|
||||
export const HDX_DISABLE_METADATA_FIELD_FETCH = env(
|
||||
'NEXT_PUBLIC_HDX_DISABLE_METADATA_FIELD_FETCH',
|
||||
);
|
||||
|
||||
export const NODE_ENV = process.env.NODE_ENV as string;
|
||||
export const HDX_API_KEY = process.env.HYPERDX_API_KEY as string; // for nextjs server
|
||||
|
|
@ -24,6 +27,8 @@ export const IS_OSS = process.env.NEXT_PUBLIC_IS_OSS ?? 'true' === 'true';
|
|||
export const IS_LOCAL_MODE = //true;
|
||||
// @ts-ignore
|
||||
(process.env.NEXT_PUBLIC_IS_LOCAL_MODE ?? 'false') === 'true';
|
||||
export const IS_METADATA_FIELD_FETCH_DISABLED =
|
||||
HDX_DISABLE_METADATA_FIELD_FETCH === 'true';
|
||||
|
||||
// Features in development
|
||||
export const IS_K8S_DASHBOARD_ENABLED = true;
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import {
|
|||
UseQueryOptions,
|
||||
} from '@tanstack/react-query';
|
||||
|
||||
import { IS_METADATA_FIELD_FETCH_DISABLED } from '@/config';
|
||||
import { getMetadata } from '@/metadata';
|
||||
import { toArray } from '@/utils';
|
||||
|
||||
|
|
@ -56,6 +57,10 @@ export function useAllFields(
|
|||
...tableConnections.map(tc => ({ ...tc })),
|
||||
],
|
||||
queryFn: async () => {
|
||||
if (IS_METADATA_FIELD_FETCH_DISABLED) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const fields2d = await Promise.all(
|
||||
tableConnections.map(tc => metadata.getAllFields(tc)),
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in a new issue