Skip to content

Commit

Permalink
Keep current view when deleting another view
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaellehmkuhl authored and patrickelectric committed Aug 2, 2023
1 parent 2400b57 commit 66f22c4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/stores/widgetManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,15 @@ export const useWidgetManagerStore = defineStore('widget-manager', () => {
return
}

const hashCurrentView = currentView.value.hash
const index = currentProfile.value.views.indexOf(view)
currentProfile.value.views.splice(index, 1)
if (index === currentViewIndex.value) {
const newIndexCurrentView = currentProfile.value.views.findIndex((v) => v.hash === hashCurrentView)
if (newIndexCurrentView === -1 || index === currentViewIndex.value) {
currentViewIndex.value = 0
return
}
currentViewIndex.value = newIndexCurrentView
}

/**
Expand Down

0 comments on commit 66f22c4

Please sign in to comment.