From 8d9ba4b7384eabb49063788b1364ecb2c779831b Mon Sep 17 00:00:00 2001 From: Thijn Date: Wed, 21 Jan 2026 15:34:43 +0100 Subject: [PATCH 1/4] fixed page and limit resetting on edit --- .vscode/settings.json | 5 ++- src/components/GenericObjectTable.vue | 12 ------- src/modals/OrganisationModal.vue | 5 +-- src/store/modules/object.js | 14 +++++--- src/views/organisaties/OrganisatieIndex.vue | 36 +++++++-------------- 5 files changed, 27 insertions(+), 45 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index a081f47..688e3c9 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,5 +2,8 @@ "editor.defaultFormatter": "dbaeumer.vscode-eslint", "editor.formatOnSave": true, "eslint.alwaysShowStatus": true, - "eslint.format.enable": true +"eslint.format.enable": true, +"[javascript]": { + "editor.defaultFormatter": "dbaeumer.vscode-eslint" +} } diff --git a/src/components/GenericObjectTable.vue b/src/components/GenericObjectTable.vue index af90618..81bb4c9 100644 --- a/src/components/GenericObjectTable.vue +++ b/src/components/GenericObjectTable.vue @@ -1,15 +1,3 @@ -/** - * GenericObjectTable.vue - * Generic component for displaying objects with cards and table view - * @category Components - * @package opencatalogi - * @author Ruben Linde - * @copyright 2024 - * @license AGPL-3.0-or-later - * @version 1.0.0 - * @link https://github.com/opencatalogi/opencatalogi - */ - diff --git a/src/modals/OrganisationModal.vue b/src/modals/OrganisationModal.vue index fbf639b..b8d2b40 100644 --- a/src/modals/OrganisationModal.vue +++ b/src/modals/OrganisationModal.vue @@ -348,10 +348,11 @@ export default { this.success = true // Refresh organisation list + const pagination = objectStore.getPagination('organisatie') await objectStore.fetchCollection('organisatie', { _extend: '@self.schema,contactpersonen', - _limit: 20, - _page: 1, + _limit: pagination.limit || 20, + _page: pagination.page || 1, }) // Start countdown timer diff --git a/src/store/modules/object.js b/src/store/modules/object.js index fce0869..f615470 100644 --- a/src/store/modules/object.js +++ b/src/store/modules/object.js @@ -853,9 +853,7 @@ export const useObjectStore = defineStore('object', { const paginationInfo = { total: data.total || 0, page: data.page || 1, - pages: - data.pages - || (data.next ? Math.ceil((data.total || 0) / (data.limit || 20)) : 1), + pages: data.pages || (data.next ? Math.ceil((data.total || 0) / (data.limit || 20)) : 1), limit: data.limit || 20, next: data.next || null, prev: data.prev || null, @@ -1298,8 +1296,14 @@ export const useObjectStore = defineStore('object', { if (!this.objects[type]) this.objects[type] = {} this.objects[type][id] = updatedObject - // Refresh the collection to ensure it's up to date - await this.fetchCollection(type) + // Refresh the collection to ensure it's up to date, preserving current pagination + const pagination = this.pagination[type] + const refreshParams = {} + if (pagination && pagination.limit >= 10) { + refreshParams._page = pagination.page + refreshParams._limit = pagination.limit + } + await this.fetchCollection(type, refreshParams) // If this is the active object, update it if (this.activeObjects[type]?.id === id) { diff --git a/src/views/organisaties/OrganisatieIndex.vue b/src/views/organisaties/OrganisatieIndex.vue index 6b58dd2..2b97efe 100644 --- a/src/views/organisaties/OrganisatieIndex.vue +++ b/src/views/organisaties/OrganisatieIndex.vue @@ -1,15 +1,3 @@ -/** - * OrganisatieIndex.vue - * Component for displaying and managing organisaties using GenericObjectTable - * @category Views - * @package softwarecatalog - * @author Ruben Linde - * @copyright 2024 - * @license AGPL-3.0-or-later - * @version 1.0.0 - * @link https://github.com/opencatalogi/softwarecatalog - */ -