From c3d207e5470a550b619edf804b6c7c906842486e Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Wed, 5 Feb 2020 09:49:03 -0500 Subject: [PATCH] add back withRouter to see if it fixes the app not working --- ui/component/router/view.jsx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/ui/component/router/view.jsx b/ui/component/router/view.jsx index 75c4aa001..e0329d91b 100644 --- a/ui/component/router/view.jsx +++ b/ui/component/router/view.jsx @@ -1,7 +1,7 @@ // @flow import * as PAGES from 'constants/pages'; import React, { useEffect } from 'react'; -import { Route, Redirect, Switch } from 'react-router-dom'; +import { Route, Redirect, Switch, withRouter } from 'react-router-dom'; import SettingsPage from 'page/settings'; import HelpPage from 'page/help'; import ReportPage from 'page/report'; @@ -38,6 +38,7 @@ if ('scrollRestoration' in history) { type PrivateRouteProps = { component: any, isAuthenticated: boolean, + location: { pathname: string }, }; function PrivateRoute(props: PrivateRouteProps) { @@ -49,7 +50,7 @@ function PrivateRoute(props: PrivateRouteProps) { isAuthenticated || !IS_WEB ? ( ) : ( - + ) } /> @@ -59,11 +60,15 @@ function PrivateRoute(props: PrivateRouteProps) { type Props = { currentScroll: number, isAuthenticated: boolean, + location: { pathname: string, search: string }, }; function AppRouter(props: Props) { - const { currentScroll, isAuthenticated } = props; - const { pathname } = window.location; + const { + currentScroll, + location: { pathname }, + isAuthenticated, + } = props; useEffect(() => { window.scrollTo(0, currentScroll); @@ -120,4 +125,4 @@ function AppRouter(props: Props) { ); } -export default AppRouter; +export default withRouter(AppRouter);