Skip to content

Commit

Permalink
feat(ui): on active tab, auto expand parent folder in sidebar if coll…
Browse files Browse the repository at this point in the history
…apsed before scrolling into view
  • Loading branch information
flawiddsouza committed Mar 8, 2024
1 parent 62f89d9 commit 5067458
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/ui/src/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,18 @@ function setActiveTab(state, tab, scrollSidebarItemIntoView = false, persistActi
state.activeTab = tab
loadResponses(state, tab._id)
if(scrollSidebarItemIntoView) {
if(tab.parentId) {
let currentParentId = tab.parentId;

Check failure on line 77 in packages/ui/src/store.js

View workflow job for this annotation

GitHub Actions / test

Extra semicolon
while (currentParentId) {
const parentFolder = findItemInTreeById(state.collectionTree, currentParentId)
if(parentFolder && parentFolder.collapsed) {
parentFolder.collapsed = false
store.dispatch('saveCollectionItemCollapsedState', { _id: parentFolder._id, collapsed: parentFolder.collapsed })
console.log(`parent folder ${parentFolder.name} was collapsed and has been auto expanded`)
}
currentParentId = parentFolder.parentId;

Check failure on line 85 in packages/ui/src/store.js

View workflow job for this annotation

GitHub Actions / test

Extra semicolon
}
}
nextTick(() => {
const activeSidebarElement = document.querySelector(`.sidebar-list-container div[data-id="${tab._id}"]`)
if(activeSidebarElement) {
Expand Down

0 comments on commit 5067458

Please sign in to comment.