Skip to content

Commit

Permalink
fix(routing): handle record param deletion on wrong tab and fix tab c…
Browse files Browse the repository at this point in the history
…hange due to missing dep in useCallback
  • Loading branch information
harshpatel-crest committed Apr 9, 2021
1 parent 0d48b1d commit a9fe88b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
4 changes: 4 additions & 0 deletions ui/src/main/webapp/components/table/CustomTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ function CustomTable({
// useEffect dependency which will only be changed in case of editing entity
setEntityModal({ ...entityModal, open: false });
}
} else if (query.get('tab') !== serviceName && query.get('record')) {
// remove the record param in case of wrong tab
query.delete('record');
history.push({ search: query.toString() });
}
}, [history.location.search]);

Expand Down
13 changes: 8 additions & 5 deletions ui/src/main/webapp/pages/Configuration/ConfigurationPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,14 @@ function ConfigurationPage() {
}
}, []);

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

return (
<ErrorBoundary>
Expand Down

0 comments on commit a9fe88b

Please sign in to comment.