From 1e47181fb7c93b67317053b7bc69491617468de0 Mon Sep 17 00:00:00 2001 From: rashmi73 Date: Fri, 14 Jun 2019 03:20:22 +0530 Subject: [PATCH 1/3] issue 2542 fix --- src/shared/components/Header/index.jsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/shared/components/Header/index.jsx b/src/shared/components/Header/index.jsx index 26afbfc7e7..16a9620ee6 100644 --- a/src/shared/components/Header/index.jsx +++ b/src/shared/components/Header/index.jsx @@ -35,6 +35,8 @@ const Header = ({ profile }) => { normalizedProfile = null; } + let pathname = window.location.pathname; + if (TopNavRef) { return (
@@ -57,6 +59,7 @@ const Header = ({ profile }) => { theme={config.HEADER_MENU_THEME} currentLevel1Id={activeLevel1Id} onChangeLevel1Id={handleChangeLevel1Id} + path={pathname} />
); From b5651e233eca613c486e1db401d9bfc82a7cdf6b Mon Sep 17 00:00:00 2001 From: rashmi73 Date: Sat, 15 Jun 2019 01:47:05 +0530 Subject: [PATCH 2/3] issue 2542 window fix --- src/shared/components/Header/index.jsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/shared/components/Header/index.jsx b/src/shared/components/Header/index.jsx index 16a9620ee6..5fb11d0fea 100644 --- a/src/shared/components/Header/index.jsx +++ b/src/shared/components/Header/index.jsx @@ -1,5 +1,5 @@ import _ from 'lodash'; -import React, { useState } from 'react'; +import React, { useState, useEffect } from 'react'; import PT from 'prop-types'; import { config } from 'topcoder-react-utils'; import Logo from 'assets/images/tc-logo.svg'; @@ -18,6 +18,7 @@ try { const Header = ({ profile }) => { const [activeLevel1Id, setActiveLevel1Id] = useState(); + const [path, setPath] = useState(); const handleChangeLevel1Id = (menuId) => { setActiveLevel1Id(menuId); @@ -35,8 +36,9 @@ const Header = ({ profile }) => { normalizedProfile = null; } - let pathname = window.location.pathname; - + useEffect(() => { + setPath(window.location.pathname); + }, []) if (TopNavRef) { return (
@@ -59,7 +61,7 @@ const Header = ({ profile }) => { theme={config.HEADER_MENU_THEME} currentLevel1Id={activeLevel1Id} onChangeLevel1Id={handleChangeLevel1Id} - path={pathname} + path={path} />
); From 507ac3969c51b40fe244a959b964c64dd9f5814e Mon Sep 17 00:00:00 2001 From: rashmi73 Date: Wed, 19 Jun 2019 22:32:15 +0530 Subject: [PATCH 3/3] test fix --- src/shared/components/Header/index.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/components/Header/index.jsx b/src/shared/components/Header/index.jsx index 5fb11d0fea..3f03dea130 100644 --- a/src/shared/components/Header/index.jsx +++ b/src/shared/components/Header/index.jsx @@ -38,7 +38,7 @@ const Header = ({ profile }) => { useEffect(() => { setPath(window.location.pathname); - }, []) + }, []); if (TopNavRef) { return (