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 <suzhou@amazon.com>
Signed-off-by:  Ramakrishna Chilaka <49393831+RamakrishnaChilaka@users.noreply.github.com>
  • Loading branch information
RamakrishnaChilaka and SuZhou-Joe authored Mar 21, 2024
1 parent 9ef5c90 commit c208fa9
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 c208fa9

Please sign in to comment.