mirror of
https://github.com/hyperdxio/hyperdx
synced 2026-04-21 13:37:15 +00:00
fix: stop localmode premature fetches & discover existing sources during onboarding (#1811)
In localmode and the clickhouse build, it is common to hit a scenario where a connection is not defined, but sources are. This causes the search page to start spamming queries without any credentials, which causes the browser to repeatedly show a prompt for auth credentials and kills the whole onboarding process. Additionally, after creating a connection in the onboarding modal, the sources were not discovered by the onboarding modal and would force you to redefine a source even though you had some saved. This PR fixes both of those issues. Closes HDX-3515 Closes HDX-3516
This commit is contained in:
parent
a6edb0dd4c
commit
578b1eea9e
4 changed files with 23 additions and 1 deletions
6
.changeset/thirty-years-smile.md
Normal file
6
.changeset/thirty-years-smile.md
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
"@hyperdx/app": patch
|
||||
---
|
||||
|
||||
fix: localmode stops prematurely fetching data
|
||||
fix: users do not have to keep defining sources during onboarding modal if they already have sources
|
||||
|
|
@ -234,6 +234,18 @@ function OnboardingModalComponent({
|
|||
setStep(startStep);
|
||||
}
|
||||
}, [startStep, step]);
|
||||
useEffect(() => {
|
||||
if (
|
||||
(step === 'auto-detect' || step === 'source') &&
|
||||
sources &&
|
||||
sources.length > 0
|
||||
) {
|
||||
// Sources may load in late once a connection is defined.
|
||||
// If this happens, close the modal, we don't want to bother the user
|
||||
// by forcing redefining their sources
|
||||
setStep('closed');
|
||||
}
|
||||
}, [step, sources]);
|
||||
|
||||
const createSourceMutation = useCreateSource();
|
||||
const createConnectionMutation = useCreateConnection();
|
||||
|
|
|
|||
|
|
@ -97,6 +97,7 @@ export function useCreateConnection() {
|
|||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ['connections'] });
|
||||
queryClient.invalidateQueries({ queryKey: ['sources'] });
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,8 @@ import { HDX_LOCAL_DEFAULT_SOURCES } from '@/config';
|
|||
import { IS_LOCAL_MODE } from '@/config';
|
||||
import { parseJSON } from '@/utils';
|
||||
|
||||
import { getLocalConnections } from './connection';
|
||||
|
||||
// Columns for the sessions table as of OTEL Collector v0.129.1
|
||||
export const SESSION_TABLE_EXPRESSIONS = {
|
||||
resourceAttributesExpression: 'ResourceAttributes',
|
||||
|
|
@ -47,7 +49,8 @@ function setLocalSources(fn: (prev: TSource[]) => TSource[]) {
|
|||
}
|
||||
|
||||
function getLocalSources(): TSource[] {
|
||||
if (store.has(LOCAL_STORE_SOUCES_KEY)) {
|
||||
const connections = getLocalConnections();
|
||||
if (connections.length > 0 && store.has(LOCAL_STORE_SOUCES_KEY)) {
|
||||
return store.get(LOCAL_STORE_SOUCES_KEY, []) ?? [];
|
||||
}
|
||||
// pull sources from env var
|
||||
|
|
|
|||
Loading…
Reference in a new issue