qdadm 0.25.0 → 0.26.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ref, computed, watch, onMounted, inject, provide } from 'vue'
|
|
1
|
+
import { ref, computed, watch, onMounted, inject, provide, nextTick } from 'vue'
|
|
2
2
|
import { useRouter, useRoute } from 'vue-router'
|
|
3
3
|
import { useToast } from 'primevue/usetoast'
|
|
4
4
|
import { useConfirm } from 'primevue/useconfirm'
|
|
@@ -170,6 +170,7 @@ export function useListPageBuilder(config = {}) {
|
|
|
170
170
|
const loading = ref(false)
|
|
171
171
|
const selected = ref([])
|
|
172
172
|
const deleting = ref(false)
|
|
173
|
+
let isRestoringFilters = false // Flag to skip watch during restore
|
|
173
174
|
|
|
174
175
|
// Pagination (load from cookie if available)
|
|
175
176
|
const page = ref(1)
|
|
@@ -508,7 +509,7 @@ export function useListPageBuilder(config = {}) {
|
|
|
508
509
|
function onFiltersChanged() {
|
|
509
510
|
page.value = 1
|
|
510
511
|
loadItems()
|
|
511
|
-
// Persist filters to session storage
|
|
512
|
+
// Persist filters + search to session storage
|
|
512
513
|
if (persistFilters) {
|
|
513
514
|
const toPersist = {}
|
|
514
515
|
for (const [name, value] of Object.entries(filterValues.value)) {
|
|
@@ -517,6 +518,10 @@ export function useListPageBuilder(config = {}) {
|
|
|
517
518
|
toPersist[name] = value
|
|
518
519
|
}
|
|
519
520
|
}
|
|
521
|
+
// Also persist search query
|
|
522
|
+
if (searchQuery.value) {
|
|
523
|
+
toPersist._search = searchQuery.value
|
|
524
|
+
}
|
|
520
525
|
setSessionFilters(filterSessionKey, toPersist)
|
|
521
526
|
}
|
|
522
527
|
// Sync to URL query params
|
|
@@ -895,6 +900,8 @@ export function useListPageBuilder(config = {}) {
|
|
|
895
900
|
* Restore filter values from URL query params (priority) or session storage
|
|
896
901
|
*/
|
|
897
902
|
function restoreFilters() {
|
|
903
|
+
isRestoringFilters = true // Prevent watch from triggering during restore
|
|
904
|
+
|
|
898
905
|
// Priority 1: URL query params
|
|
899
906
|
const urlFilters = {}
|
|
900
907
|
for (const key of filtersMap.value.keys()) {
|
|
@@ -913,8 +920,17 @@ export function useListPageBuilder(config = {}) {
|
|
|
913
920
|
searchQuery.value = route.query.search
|
|
914
921
|
}
|
|
915
922
|
|
|
916
|
-
// Priority 2: Session storage (only for filters not in URL)
|
|
917
|
-
const
|
|
923
|
+
// Priority 2: Session storage (only for filters/search not in URL)
|
|
924
|
+
const sessionData = persistFilters ? getSessionFilters(filterSessionKey) : null
|
|
925
|
+
|
|
926
|
+
// Extract search from session (stored as _search)
|
|
927
|
+
if (sessionData?._search && !route.query.search) {
|
|
928
|
+
searchQuery.value = sessionData._search
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
// Remove _search from session data before merging with filters
|
|
932
|
+
const sessionFilters = sessionData ? { ...sessionData } : null
|
|
933
|
+
if (sessionFilters) delete sessionFilters._search
|
|
918
934
|
|
|
919
935
|
// Merge: URL takes priority over session
|
|
920
936
|
const restoredFilters = { ...sessionFilters, ...urlFilters }
|
|
@@ -925,6 +941,11 @@ export function useListPageBuilder(config = {}) {
|
|
|
925
941
|
filterValues.value[name] = value
|
|
926
942
|
}
|
|
927
943
|
}
|
|
944
|
+
|
|
945
|
+
// Reset flag after Vue processes updates
|
|
946
|
+
nextTick(() => {
|
|
947
|
+
isRestoringFilters = false
|
|
948
|
+
})
|
|
928
949
|
}
|
|
929
950
|
|
|
930
951
|
// ============ ACTIONS ============
|
|
@@ -1221,6 +1242,8 @@ export function useListPageBuilder(config = {}) {
|
|
|
1221
1242
|
// ============ WATCHERS ============
|
|
1222
1243
|
let searchTimeout = null
|
|
1223
1244
|
watch(searchQuery, () => {
|
|
1245
|
+
// Skip watch during restore (loadItems will be called after restore)
|
|
1246
|
+
if (isRestoringFilters) return
|
|
1224
1247
|
clearTimeout(searchTimeout)
|
|
1225
1248
|
searchTimeout = setTimeout(() => {
|
|
1226
1249
|
// Use onFiltersChanged to also sync URL params
|