diff --git a/public/app.tsx b/public/app.tsx index de205a60..78e29ef1 100644 --- a/public/app.tsx +++ b/public/app.tsx @@ -4,7 +4,12 @@ */ import React from 'react'; -import { Route, RouteComponentProps, Switch } from 'react-router-dom'; +import { + Route, + RouteComponentProps, + Switch, + useLocation, +} from 'react-router-dom'; import { EuiPageSideBar, EuiSideNav, @@ -19,8 +24,10 @@ import { WorkflowsRouterProps, } from './pages'; import { MountPoint } from '../../../src/core/public'; -import queryString from 'query-string'; -import { constructHrefWithDataSourceId } from './utils/utils'; +import { + constructHrefWithDataSourceId, + getDataSourceFromURL, +} from './utils/utils'; // styling import './global-styles.scss'; @@ -31,9 +38,8 @@ interface Props extends RouteComponentProps { export const FlowFrameworkDashboardsApp = (props: Props) => { const { setHeaderActionMenu } = props; - const queryParams = queryString.parse(location.search) as { - [key: string]: string; - }; + const location = useLocation(); + const queryParams = getDataSourceFromURL(location); const dataSourceId = queryParams.dataSourceId; const sidebar = (