refactor: refs #8207 improve logic
gitea/salix-front/pipeline/pr-master This commit looks good Details

This commit is contained in:
Jorge Penadés 2024-11-22 15:49:07 +01:00
parent 661cc0b5ee
commit 9d8698fa2f
1 changed files with 5 additions and 5 deletions

View File

@ -130,19 +130,19 @@ const addFilter = async (filter, params) => {
await arrayData.addFilter({ filter, params }); await arrayData.addFilter({ filter, params });
}; };
async function fetch(params, keepRowsNumber = false) { async function fetch(params, keepPagination = false) {
useArrayData(props.dataKey, params); useArrayData(props.dataKey, params);
const { limit, skip } = arrayData.store; const { limit, skip } = arrayData.store;
if (keepRowsNumber) { if (!keepPagination) await arrayData.fetch({ append: false });
else {
arrayData.store.limit = limit + skip; arrayData.store.limit = limit + skip;
arrayData.store.skip = 0; arrayData.store.skip = 0;
} await arrayData.fetch({ append: false });
await arrayData.fetch({ append: false });
if (keepRowsNumber) {
arrayData.store.limit = limit; arrayData.store.limit = limit;
arrayData.store.skip = skip; arrayData.store.skip = skip;
} }
if (!store.hasMoreData) isLoading.value = false; if (!store.hasMoreData) isLoading.value = false;
emit('onFetch', store.data); emit('onFetch', store.data);