Skip to content

Commit

Permalink
Merge pull request #4680 from dfe-analytical-services/EES-5020
Browse files Browse the repository at this point in the history
EES-5020 fix server rendered release pages
  • Loading branch information
amyb-hiveit authored Mar 20, 2024
2 parents 08732c5 + 7948464 commit d3e7a31
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/explore-education-statistics-common/src/components/Tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ interface Props {

const Tabs = ({ children, id, modifyHash = true, testId, onToggle }: Props) => {
const [selectedTabIndex, setSelectedTabIndex] = useState(0);
const [hasCheckedHash, setHasCheckedHash] = useState<boolean>(
!window.location.hash,
);
const [hasCheckedHash, setHasCheckedHash] = useState<boolean>();
const ref = useRef<HTMLDivElement>(null);

const { onMedia } = useDesktopMedia();
Expand Down Expand Up @@ -98,6 +96,12 @@ const Tabs = ({ children, id, modifyHash = true, testId, onToggle }: Props) => {
[sections],
);

useEffect(() => {
if (window) {
setHasCheckedHash(!window.location.hash);
}
}, []);

useEffect(() => {
const handleHashChange = () => {
if (window.location.hash) {
Expand Down

0 comments on commit d3e7a31

Please sign in to comment.