mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-12 12:18:58 +08:00
feat: disabled same url check for traces query builder as well
This commit is contained in:
parent
cb69cd91a0
commit
114a979b14
@ -13,7 +13,7 @@ interface SafeNavigateParams {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface UseSafeNavigateProps {
|
interface UseSafeNavigateProps {
|
||||||
enableSameURLCheck?: boolean;
|
preventSameUrlNavigation?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const areUrlsEffectivelySame = (url1: URL, url2: URL): boolean => {
|
const areUrlsEffectivelySame = (url1: URL, url2: URL): boolean => {
|
||||||
@ -83,7 +83,9 @@ const isDefaultNavigation = (currentUrl: URL, targetUrl: URL): boolean => {
|
|||||||
return newKeys.length > 0;
|
return newKeys.length > 0;
|
||||||
};
|
};
|
||||||
export const useSafeNavigate = (
|
export const useSafeNavigate = (
|
||||||
{ enableSameURLCheck }: UseSafeNavigateProps = { enableSameURLCheck: true },
|
{ preventSameUrlNavigation }: UseSafeNavigateProps = {
|
||||||
|
preventSameUrlNavigation: true,
|
||||||
|
},
|
||||||
): {
|
): {
|
||||||
safeNavigate: (
|
safeNavigate: (
|
||||||
to: string | SafeNavigateParams,
|
to: string | SafeNavigateParams,
|
||||||
@ -114,7 +116,7 @@ export const useSafeNavigate = (
|
|||||||
const urlsAreSame = areUrlsEffectivelySame(currentUrl, targetUrl);
|
const urlsAreSame = areUrlsEffectivelySame(currentUrl, targetUrl);
|
||||||
const isDefaultParamsNavigation = isDefaultNavigation(currentUrl, targetUrl);
|
const isDefaultParamsNavigation = isDefaultNavigation(currentUrl, targetUrl);
|
||||||
|
|
||||||
if (enableSameURLCheck && urlsAreSame) {
|
if (preventSameUrlNavigation && urlsAreSame) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,7 +137,7 @@ export const useSafeNavigate = (
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[navigate, location.pathname, location.search, enableSameURLCheck],
|
[navigate, location.pathname, location.search, preventSameUrlNavigation],
|
||||||
);
|
);
|
||||||
|
|
||||||
return { safeNavigate };
|
return { safeNavigate };
|
||||||
|
@ -764,7 +764,10 @@ export function QueryBuilderProvider({
|
|||||||
);
|
);
|
||||||
|
|
||||||
const { safeNavigate } = useSafeNavigate({
|
const { safeNavigate } = useSafeNavigate({
|
||||||
enableSameURLCheck: !(initialDataSource === DataSource.LOGS),
|
preventSameUrlNavigation: !(
|
||||||
|
initialDataSource === DataSource.LOGS ||
|
||||||
|
initialDataSource === DataSource.TRACES
|
||||||
|
),
|
||||||
});
|
});
|
||||||
|
|
||||||
const redirectWithQueryBuilderData = useCallback(
|
const redirectWithQueryBuilderData = useCallback(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user