diff --git a/datahub-web-react/src/app/context/UserContextProvider.tsx b/datahub-web-react/src/app/context/UserContextProvider.tsx index 4a9f24cdea30e..3bcff15cc2748 100644 --- a/datahub-web-react/src/app/context/UserContextProvider.tsx +++ b/datahub-web-react/src/app/context/UserContextProvider.tsx @@ -3,7 +3,6 @@ import { useGetMeLazyQuery } from '../../graphql/me.generated'; import { useGetGlobalViewsSettingsLazyQuery } from '../../graphql/app.generated'; import { CorpUser, PlatformPrivileges } from '../../types.generated'; import { UserContext, LocalState, DEFAULT_STATE, State } from './userContext'; -import { useInitialRedirect } from './useInitialRedirect'; // TODO: Migrate all usage of useAuthenticatedUser to using this provider. @@ -125,11 +124,6 @@ const UserContextProvider = ({ children }: { children: React.ReactNode }) => { } }, [state, localState.selectedViewUrn, setDefaultSelectedView]); - /** - * Route to the most recently visited path once on first load of home page, if present in local storage. - */ - useInitialRedirect(state, localState, setState, updateLocalState); - return ( { - if (!state.loadedInitialPath) { - if (location.pathname === PageRoutes.ROOT && localState.selectedPath !== location.pathname) { - if (localState.selectedPath && !localState.selectedPath.includes(PageRoutes.EMBED)) { - history.replace({ - pathname: localState.selectedPath, - search: localState.selectedSearch || '', - }); - } - } - setState({ - ...state, - loadedInitialPath: true, - }); - } - }, [ - localState.selectedPath, - localState.selectedSearch, - location.pathname, - location.search, - state, - history, - setState, - ]); - - /** - * When the location of the browse changes, save the latest to local state. - */ - useEffect(() => { - if ( - (localState.selectedPath !== location.pathname || localState.selectedSearch !== location.search) && - !location.pathname.includes(PageRoutes.EMBED) - ) { - setLocalState({ - ...localState, - selectedPath: location.pathname, - selectedSearch: location.search, - }); - } - }, [location.pathname, location.search, localState, setLocalState]); -} diff --git a/datahub-web-react/src/app/context/userContext.tsx b/datahub-web-react/src/app/context/userContext.tsx index b6cbe6250e4ed..2e174d38247f5 100644 --- a/datahub-web-react/src/app/context/userContext.tsx +++ b/datahub-web-react/src/app/context/userContext.tsx @@ -22,10 +22,6 @@ export type State = { loadedPersonalDefaultViewUrn: boolean; hasSetDefaultView: boolean; }; - /** - * Whether the initial page path has been loaded. - */ - loadedInitialPath: boolean; }; /** @@ -54,7 +50,6 @@ export const DEFAULT_STATE: State = { loadedPersonalDefaultViewUrn: false, hasSetDefaultView: false, }, - loadedInitialPath: false, }; export const DEFAULT_CONTEXT = {