Skip to content

Commit

Permalink
fix: initial default tab query param
Browse files Browse the repository at this point in the history
  • Loading branch information
harshpatel-crest committed Mar 31, 2021
1 parent a4a0542 commit 2d4d7dd
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,19 @@ function ConfigurationPage() {
}
}, [history.location.search]);

const handleChange = (e, { selectedTabId }) => {
// Run only once to set initial default tab query param
useEffect(() => {
if (!query.get('tab')) {
query.set('tab', activeTabId);
history.push({ search: query.toString() });
}
}, []);

const handleChange = useCallback((e, { selectedTabId }) => {
setActiveTabId(selectedTabId);
query.set('tab', selectedTabId);
history.push({ search: query.toString() });
};
}, []);

return (
<ErrorBoundary>
Expand Down

0 comments on commit 2d4d7dd

Please sign in to comment.