pages/search: store: closeCurrentTab

This commit is contained in:
He4eT 2024-01-21 20:36:39 +01:00
commit c6f4fda801
4 changed files with 12 additions and 13 deletions

View file

@ -4,6 +4,7 @@ const fuzzysort = window.fuzzysort
export const init = ({
tabs: browserTabs,
onStateUpdate,
closeCurrentTab,
}) => {
/* Initial state */
const state = {
@ -66,7 +67,9 @@ export const init = ({
goToTab(id) {
browserTabs.update(id, { active: true })
.then(updateState)
.then(closeCurrentTab)
},
closeCurrentTab,
closeTab(id) {
browserTabs.remove(id)
.then(updateState)