From 63715dcdef8abc4b5e9c6380e56262f0480e7d14 Mon Sep 17 00:00:00 2001 From: MeetzhDing Date: Sat, 3 Jul 2021 00:19:58 +0800 Subject: [PATCH] fix: #36322 HistoryWrapper constructor history param not work (#36367) --- 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);