Skip to content

Commit

Permalink
Fix reactRouterNavigate when used with a string (#80520) (#81162)
Browse files Browse the repository at this point in the history
* Fix reactRouterNavigate when used with a string

* Update license management snapshots

Co-authored-by: Kibana Machine <[email protected]>

Co-authored-by: Kibana Machine <[email protected]>
  • Loading branch information
yuliacech and kibanamachine authored Oct 20, 2020
1 parent 423ae87 commit e15e077
Show file tree
Hide file tree
Showing 2 changed files with 104 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import { ScopedHistory } from 'kibana/public';
import { History } from 'history';
import { History, parsePath } from 'history';

interface LocationObject {
pathname?: string;
Expand All @@ -32,7 +32,7 @@ const isModifiedEvent = (event: any) =>
const isLeftClickEvent = (event: any) => event.button === 0;

export const toLocationObject = (to: string | LocationObject) =>
typeof to === 'string' ? { pathname: to } : to;
typeof to === 'string' ? parsePath(to) : to;

export const reactRouterNavigate = (
history: ScopedHistory | History,
Expand Down
Loading

0 comments on commit e15e077

Please sign in to comment.