Skip to content

Commit

Permalink
Update public/components/MDSEnabledComponent/MDSEnabledComponent.tsx
Browse files Browse the repository at this point in the history
Co-authored-by: SuZhou-Joe <[email protected]>
Signed-off-by:  Ramakrishna Chilaka <[email protected]>
Signed-off-by: Ramakrishna Chilaka <[email protected]>
  • Loading branch information
RamakrishnaChilaka and SuZhou-Joe committed Mar 26, 2024
1 parent f9018de commit 2c51c7a
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions public/components/MDSEnabledComponent/MDSEnabledComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,15 @@ export default class MDSEnabledComponent<
export function useUpdateUrlWithDataSourceProperties() {
const dataSourceMenuProps = useContext(DataSourceMenuContext);
const { dataSourceId, dataSourceLabel, multiDataSourceEnabled } = dataSourceMenuProps;
if (multiDataSourceEnabled) {
// mds flag can't change while the app is loaded
const history = useHistory();
useEffect(() => {
const history = useHistory();
useEffect(() => {
if (multiDataSourceEnabled) {
history.replace({
search: queryString.stringify({
dataSourceId,
dataSourceLabel,
}),
});
}, [dataSourceId, dataSourceLabel]);
}
}
}, [dataSourceId, dataSourceLabel, multiDataSourceEnabled]);
}

0 comments on commit 2c51c7a

Please sign in to comment.