mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-12 20:59:02 +08:00
fix: disabled same url check for redirect in logs explorer
This commit is contained in:
parent
2d73f91380
commit
cb69cd91a0
@ -12,6 +12,10 @@ interface SafeNavigateParams {
|
|||||||
search?: string;
|
search?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface UseSafeNavigateProps {
|
||||||
|
enableSameURLCheck?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
const areUrlsEffectivelySame = (url1: URL, url2: URL): boolean => {
|
const areUrlsEffectivelySame = (url1: URL, url2: URL): boolean => {
|
||||||
if (url1.pathname !== url2.pathname) return false;
|
if (url1.pathname !== url2.pathname) return false;
|
||||||
|
|
||||||
@ -78,7 +82,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 },
|
||||||
|
): {
|
||||||
safeNavigate: (
|
safeNavigate: (
|
||||||
to: string | SafeNavigateParams,
|
to: string | SafeNavigateParams,
|
||||||
options?: NavigateOptions,
|
options?: NavigateOptions,
|
||||||
@ -108,7 +114,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 (urlsAreSame) {
|
if (enableSameURLCheck && urlsAreSame) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,7 +135,7 @@ export const useSafeNavigate = (): {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[navigate, location.pathname, location.search],
|
[navigate, location.pathname, location.search, enableSameURLCheck],
|
||||||
);
|
);
|
||||||
|
|
||||||
return { safeNavigate };
|
return { safeNavigate };
|
||||||
|
@ -763,7 +763,9 @@ export function QueryBuilderProvider({
|
|||||||
[panelType, stagedQuery],
|
[panelType, stagedQuery],
|
||||||
);
|
);
|
||||||
|
|
||||||
const { safeNavigate } = useSafeNavigate();
|
const { safeNavigate } = useSafeNavigate({
|
||||||
|
enableSameURLCheck: !(initialDataSource === DataSource.LOGS),
|
||||||
|
});
|
||||||
|
|
||||||
const redirectWithQueryBuilderData = useCallback(
|
const redirectWithQueryBuilderData = useCallback(
|
||||||
(
|
(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user