Skip to content

Commit e18910f

Browse files
fix duplicates being pushed to uploadedDatasets from upload values
In the case of remote file uploads, for each upload value, we have the entire set of uploads in the `model.outputs` object, which would cause the same dataset to appear multiple times in the `uploadedHistoryItems` object. For other, non-remote uploads, we typically only have the matching output for the upload value in the `model.outputs` object.
1 parent 2ccc585 commit e18910f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

client/src/composables/monitorUploadedHistoryItems.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,16 @@ export function monitorUploadedHistoryItems(
3737
const uploadedDatasets: HistoryItemSummary[] = [];
3838
uploadValues.value.forEach((model) => {
3939
const outputs = model.outputs;
40+
// Some uploads (e.g.: in the case of remote file upload) may have the entire set of uploaded files
41+
// in the `outputs` object, while typically, the `outputs` object contains each individual upload.
4042
if (outputs) {
4143
Object.entries(outputs).forEach((output) => {
4244
const outputDetails = output[1] as HistoryItemSummary;
43-
uploadedDatasets.push(outputDetails);
45+
// Since there is a possibility of all uploads being in the `outputs` object,
46+
// we need to ensure that we only add unique datasets to the list.
47+
if (!uploadedDatasets.some((item) => item.id === outputDetails.id)) {
48+
uploadedDatasets.push(outputDetails);
49+
}
4450
});
4551
}
4652
});

0 commit comments

Comments
 (0)