Skip to content

Commit

Permalink
Fix reactRouterNavigate when used with a string (#80520)
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 <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
yuliacech and kibanamachine authored Oct 20, 2020
1 parent b1d04df commit c5bcef4
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 c5bcef4

Please sign in to comment.