fix: refs #8113 ensure data is an array before assignment and optimize data processing loop
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
parent
bf1b1a8f15
commit
9b86f2ddd7
|
@ -289,10 +289,10 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
|||
store.map = new Map();
|
||||
}
|
||||
|
||||
if (!map && !append) store.data = data;
|
||||
if (!Array.isArray(data) || (!map && !append)) store.data = data;
|
||||
else if (!map && append) for (const row of data) store.data.push(row);
|
||||
else
|
||||
data.forEach((row) => {
|
||||
for (const row of data) {
|
||||
const key = row[store.mapKey];
|
||||
const val = { ...row, key };
|
||||
if (store.map.has(key)) {
|
||||
|
@ -305,7 +305,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
|||
store.map.set(key, val);
|
||||
store.data.push(val);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const totalRows = computed(() => (store.data && store.data.length) || 0);
|
||||
|
|
Loading…
Reference in New Issue