From d476d80fc6640c8bb9ecd924efebf1b1bf5f7fe2 Mon Sep 17 00:00:00 2001 From: Chloe Zermatten Date: Mon, 9 Feb 2026 15:02:57 +0000 Subject: [PATCH] Bug 10190: fix: prevent duplicate ruleset load - prevent the initial API call and subsequent exhaustive applied ruleset list generation logic from running twice --- .../CirculationTriggersList.vue | 17 ++++++++--------- .../prog/js/vue/stores/circulation-rules.js | 6 ++++++ 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Admin/CirculationTriggers/CirculationTriggersList.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Admin/CirculationTriggers/CirculationTriggersList.vue index 4f52ad12663..a11b9940efe 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Admin/CirculationTriggers/CirculationTriggersList.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/Admin/CirculationTriggers/CirculationTriggersList.vue @@ -336,12 +336,6 @@ export default { displayAllApplicableRules: 1, }; }, - beforeRouteEnter(to, from, next) { - next(async vm => { - vm.filtersInitialized = true; - await vm.filterRuleSetsbySearchParam(); - }); - }, methods: { async loadRuleSets() { this.ruleSetInitialized = false; @@ -429,11 +423,16 @@ export default { this.showModal = newVal.meta && newVal.meta.showModal; }, }, - "$route.query.refresh": { - async handler(newVal) { - if (newVal) { + "$route.query": { + async handler() { + if ( + this.$route.fullPath.includes("refresh") || + this.$route.path.endsWith("circulation_triggers") + ) { + await this.$nextTick(); await this.filterRuleSetsbySearchParam(); } + this.filtersInitialized = true; }, immediate: true, }, diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/stores/circulation-rules.js b/koha-tmpl/intranet-tmpl/prog/js/vue/stores/circulation-rules.js index 3594fe63aa9..5129a704107 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/stores/circulation-rules.js +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/stores/circulation-rules.js @@ -400,6 +400,12 @@ export const useCircRulesStore = defineStore("circRules", () => { {}, { library_id: "*", effective: false } ); + if (this.currentLibraryId === "*") { + this.allCurrentLibraryRawRuleSets = + this.allDefaultLibraryRawRuleSets; + return; + } + this.allCurrentLibraryRawRuleSets = await client.circ_rules.getAll( {}, { library_id: this.currentLibraryId, effective: false } -- 2.39.5