Skip to content

Commit

Permalink
fix: auto-scroll on sidebar not working, fixes #447
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabio286 committed Sep 29, 2022
1 parent fe39c1d commit dd9c089
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/renderer/components/WorkspaceExploreBarSchema.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
<ul class="menu menu-nav pt-0">
<li
v-for="table of filteredTables"
:ref="breadcrumbs.schema === database.name && [breadcrumbs.table, breadcrumbs.view].includes(table.name) ? 'explorebarSelected' : ''"
:key="table.name"
class="menu-item"
:class="{'selected': breadcrumbs.schema === database.name && [breadcrumbs.table, breadcrumbs.view].includes(table.name)}"
Expand Down Expand Up @@ -69,7 +68,6 @@
<li
v-for="trigger of filteredTriggers"
:key="trigger.name"
:ref="breadcrumbs.schema === database.name && breadcrumbs.trigger === trigger.name ? 'explorebarSelected' : ''"
class="menu-item"
:class="{'selected': breadcrumbs.schema === database.name && breadcrumbs.trigger === trigger.name}"
@mousedown.left="selectMisc({schema: database.name, misc: trigger, type: 'trigger'})"
Expand Down Expand Up @@ -111,7 +109,6 @@
<li
v-for="(routine, i) of filteredProcedures"
:key="`${routine.name}-${i}`"
:ref="breadcrumbs.schema === database.name && breadcrumbs.routine === routine.name ? 'explorebarSelected' : ''"
class="menu-item"
:class="{'selected': breadcrumbs.schema === database.name && breadcrumbs.routine === routine.name}"
@mousedown.left="selectMisc({schema: database.name, misc: routine, type: 'routine'})"
Expand Down Expand Up @@ -145,7 +142,6 @@
<li
v-for="(func, i) of filteredTriggerFunctions"
:key="`${func.name}-${i}`"
:ref="breadcrumbs.schema === database.name && breadcrumbs.triggerFunction === func.name ? 'explorebarSelected' : ''"
class="menu-item"
:class="{'selected': breadcrumbs.schema === database.name && breadcrumbs.triggerFunction === func.name}"
@mousedown.left="selectMisc({schema: database.name, misc: func, type: 'triggerFunction'})"
Expand Down Expand Up @@ -179,7 +175,6 @@
<li
v-for="(func, i) of filteredFunctions"
:key="`${func.name}-${i}`"
:ref="breadcrumbs.schema === database.name && breadcrumbs.function === func.name ? 'explorebarSelected' : ''"
class="menu-item"
:class="{'selected': breadcrumbs.schema === database.name && breadcrumbs.function === func.name}"
@mousedown.left="selectMisc({schema: database.name, misc: func, type: 'function'})"
Expand Down Expand Up @@ -213,7 +208,6 @@
<li
v-for="scheduler of filteredSchedulers"
:key="scheduler.name"
:ref="breadcrumbs.schema === database.name && breadcrumbs.scheduler === scheduler.name ? 'explorebarSelected' : ''"
class="menu-item"
:class="{'selected': breadcrumbs.schema === database.name && breadcrumbs.scheduler === scheduler.name}"
@mousedown.left="selectMisc({schema: database.name, misc: scheduler, type: 'scheduler'})"
Expand Down Expand Up @@ -281,7 +275,6 @@ const {
} = workspacesStore;
const schemaAccordion: Ref<HTMLDetailsElement> = ref(null);
const explorebarSelected: Ref<HTMLElement[]> = ref(null);
const isLoading = ref(false);
const searchTerm = computed(() => {
Expand Down Expand Up @@ -340,7 +333,8 @@ const maxSize = computed(() => {
watch(breadcrumbs, (newVal, oldVal) => {
if (JSON.stringify(newVal) !== JSON.stringify(oldVal)) {
setTimeout(() => {
const element = explorebarSelected.value ? explorebarSelected.value[0] : null;
const element = document.querySelector<HTMLElement>('.workspace-explorebar-database .selected');
if (element) {
const rect = element.getBoundingClientRect();
const elemTop = rect.top;
Expand All @@ -353,7 +347,7 @@ watch(breadcrumbs, (newVal, oldVal) => {
element.removeAttribute('tabindex');
}
}
}, 50);
}, 100);
}
});
Expand Down

0 comments on commit dd9c089

Please sign in to comment.