From 862c9a2c73112aff04510584e3bca40530876670 Mon Sep 17 00:00:00 2001 From: "Grot (@grafanabot)" <43478413+grafanabot@users.noreply.github.com> Date: Mon, 5 Jul 2021 09:02:35 +0200 Subject: [PATCH] fix: #36322 HistoryWrapper constructor history param not work (#36367) (#36399) (cherry picked from commit 63715dcdef8abc4b5e9c6380e56262f0480e7d14) Co-authored-by: MeetzhDing --- packages/grafana-runtime/src/services/LocationService.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/grafana-runtime/src/services/LocationService.ts b/packages/grafana-runtime/src/services/LocationService.ts index ffe8d1a5185..06196ad3690 100644 --- a/packages/grafana-runtime/src/services/LocationService.ts +++ b/packages/grafana-runtime/src/services/LocationService.ts @@ -31,9 +31,10 @@ export class HistoryWrapper implements LocationService { constructor(history?: H.History) { // If no history passed create an in memory one if being called from test this.history = - history || process.env.NODE_ENV === 'test' + history || + (process.env.NODE_ENV === 'test' ? H.createMemoryHistory({ initialEntries: ['/'] }) - : H.createBrowserHistory({ basename: config.appSubUrl ?? '/' }); + : H.createBrowserHistory({ basename: config.appSubUrl ?? '/' })); this.partial = this.partial.bind(this); this.push = this.push.bind(this);