Skip to content

Commit d2b4dee

Browse files
committed
fix: remove pages while filtering
1 parent ca00298 commit d2b4dee

3 files changed

Lines changed: 16 additions & 4 deletions

File tree

web/preferences/components/pages/Pages.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ app.component('Pages', {
1515
<i class="icon icon-search perm-search-icon"></i>
1616
<input type="search" class="perm-search-input" :placeholder="$i18n.preferences.pages.search" v-model="searchQuery" spellcheck="false">
1717
</div>
18-
<page-table :pages="filteredPages" :readonly="isFiltered" @update="storePages" @remove="storePages"></page-table>
18+
<page-table :pages="filteredPages" :readonly="isFiltered" @update="storePages" @remove="removePage"></page-table>
1919
<div v-if="!isFiltered" class="item-card item-card-add" @click="$emit('navigate', 'sync')">
2020
<svg class="me-2" width="14" height="14" viewBox="0 0 16 16" fill="currentColor"><path d="M11.534 7h3.932a.25.25 0 0 1 .192.41l-1.966 2.36a.25.25 0 0 1-.384 0l-1.966-2.36a.25.25 0 0 1 .192-.41zm-11 2h3.932a.25.25 0 0 0 .192-.41L2.692 6.23a.25.25 0 0 0-.384 0L.342 8.59A.25.25 0 0 0 .534 9z"/><path fill-rule="evenodd" d="M8 3c-1.552 0-2.94.707-3.857 1.818a.5.5 0 1 1-.771-.636A6.002 6.002 0 0 1 13.917 7H12.9A5.002 5.002 0 0 0 8 3zM3.1 9a5.002 5.002 0 0 0 8.757 2.182.5.5 0 1 1 .771.636A6.002 6.002 0 0 1 2.083 9H3.1z"/></svg>
2121
<span>{{ $i18n.preferences.pages.syncHint }}</span>
@@ -52,6 +52,12 @@ app.component('Pages', {
5252
this.$remote.storage.setPages(pages)
5353
},
5454

55+
removePage(page) {
56+
const idx = this.pages.findIndex(p => p.id === page.id)
57+
if (idx !== -1) { this.pages.splice(idx, 1) }
58+
this.storePages()
59+
},
60+
5561
addFirstPage() {
5662
this.pages.push({ id: `${Date.now()}0`, label: '', url: '', session: '', persist: false })
5763
},

web/preferences/components/quick-actions/QuickActions.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ app.component('QuickActions', {
1717
<input type="search" class="perm-search-input" :placeholder="$i18n.preferences.quickActions.search" v-model="searchQuery" spellcheck="false">
1818
</div>
1919
20-
<quick-actions-table :items="filteredItems" :readonly="isFiltered" @update="store" @remove="store"></quick-actions-table>
20+
<quick-actions-table :items="filteredItems" :readonly="isFiltered" @update="store" @remove="removeItem"></quick-actions-table>
2121
2222
<!-- Variables reference (collapsible) -->
2323
<div v-if="items" class="ws-variables-section">
@@ -74,5 +74,11 @@ app.component('QuickActions', {
7474
store() {
7575
this.$remote.storage.setQuickActions(Vue.toRaw(this.items))
7676
},
77+
78+
removeItem(item) {
79+
const idx = this.items.findIndex(i => i.id === item.id)
80+
if (idx !== -1) { this.items.splice(idx, 1) }
81+
this.store()
82+
},
7783
}
7884
})

web/preferences/components/quick-actions/QuickActionsTable.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ app.component('QuickActionsTable', {
8888

8989
removeItem(event, index) {
9090
event.stopPropagation()
91-
this.list.splice(index, 1)
92-
this.$emit('remove')
91+
const removed = this.list.splice(index, 1)[0]
92+
this.$emit('remove', removed)
9393
},
9494

9595
emitUpdate() { this.$emit('update') },

0 commit comments

Comments
 (0)