From 2f9828a662a91bcbd49e582df37b73fdb7a0a7d5 Mon Sep 17 00:00:00 2001 From: Matt Blenkinsop Date: Wed, 29 Nov 2023 14:54:33 +0000 Subject: [PATCH] Bug 32474: Fix persistence of selections when pagination re-triggers Currently when the select is closed and then re-opens, the pagination is re-triggered which removes the data that the lable is being pulled from for the select. This patch addresses this by keeping the currently selected piece of data and adding it into the re-paginated array of data. --- .../prog/js/vue/components/InfiniteScrollSelect.vue | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/InfiniteScrollSelect.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/InfiniteScrollSelect.vue index 9dac42b808..0f7952a488 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/InfiniteScrollSelect.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/InfiniteScrollSelect.vue @@ -76,6 +76,11 @@ export default { }, methods: { async fetchInitialData(dataType) { + const currentSelection = this.modelValue + ? this.data.find( + item => this.modelValue === item[this.dataIdentifier] + ) + : null const client = APIClient.erm await client[dataType] .getAll( @@ -88,7 +93,9 @@ export default { ) .then( items => { - this.data = items + this.data = currentSelection + ? [currentSelection, ...items] + : items this.search = "" this.limit = 19 this.scrollPage = 1 -- 2.37.1 (Apple Git-137.1)