From db54a658a2dd305a64a9869b3839921d9d70f0b4 Mon Sep 17 00:00:00 2001 From: Lauri Nevala Date: Thu, 27 May 2021 21:33:19 +0300 Subject: [PATCH] Fix Navigation.navigate to work with fragments (#2890) --- src/renderer/navigation/helpers.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/renderer/navigation/helpers.ts b/src/renderer/navigation/helpers.ts index 8991f9519f..d7b307f4c8 100644 --- a/src/renderer/navigation/helpers.ts +++ b/src/renderer/navigation/helpers.ts @@ -20,17 +20,20 @@ */ import type { LocationDescriptor } from "history"; +import { createPath } from "history"; import { matchPath, RouteProps } from "react-router"; import { PageParam, PageParamInit } from "./page-param"; import { clusterViewRoute, IClusterViewRouteParams } from "../components/cluster-manager/cluster-view.route"; import { navigation } from "./history"; export function navigate(location: LocationDescriptor) { - const currentLocation = navigation.location.pathname; + const currentLocation = createPath(navigation.location); navigation.push(location); - if (currentLocation === navigation.location.pathname) { + const newLocation = createPath(navigation.location); + + if (currentLocation === newLocation) { navigation.goBack(); // prevent sequences of same url in history } }