LandingPage: Fixes tabs selection on browser back/forward.
In the context of HMS-parity with edge management, fixes the current behavior when using browser history back and forward. - When selecting a tab and then push the browser history back/forward, the tab of the current url is selected. FIXES: https://issues.redhat.com/browse/THEEDGE-3460
This commit is contained in:
parent
ea89a92bf1
commit
e726ddc2a1
1 changed files with 4 additions and 1 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import React, { useState } from 'react';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
|
||||
import {
|
||||
Alert,
|
||||
|
|
@ -50,6 +50,9 @@ export const LandingPage = () => {
|
|||
const initialActiveTabKey =
|
||||
tabsPath.indexOf(pathname) >= 0 ? tabsPath.indexOf(pathname) : 0;
|
||||
const [activeTabKey, setActiveTabKey] = useState(initialActiveTabKey);
|
||||
useEffect(() => {
|
||||
setActiveTabKey(initialActiveTabKey);
|
||||
}, [pathname]);
|
||||
const handleTabClick = (_event, tabIndex) => {
|
||||
const tabPath = tabsPath[tabIndex];
|
||||
if (tabPath !== undefined) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue