diff --git a/frontend/libs/console/legacy-ce/src/lib/components/Services/Data/DataSubSidebar.js b/frontend/libs/console/legacy-ce/src/lib/components/Services/Data/DataSubSidebar.js index 5704f144c9994..9896210093230 100644 --- a/frontend/libs/console/legacy-ce/src/lib/components/Services/Data/DataSubSidebar.js +++ b/frontend/libs/console/legacy-ce/src/lib/components/Services/Data/DataSubSidebar.js @@ -106,15 +106,15 @@ const DataSubSidebar = props => { const onSchemaChange = value => { if (value === currentSchema) { - dispatch(_push(`/data/${currentDataSource}/schema/${value}`)); - return; + // Clicking the same schema again should collapse the treeview node + value = undefined; } setSchemaLoading(true); dispatch(updateCurrentSchema(value, currentDataSource)) .then(() => { - if (value === currentSchema) { - dispatch(_push(`/data/${currentDataSource}/schema/${value}`)); + if (!value) { + dispatch(_push(`/data/${currentDataSource}`)); } }) .finally(() => {