From 427efb903c2f23c5ddc05ce75d869fdb187d771d Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Wed, 11 Feb 2026 01:55:05 +0000
Subject: [PATCH] =added upload tracking for crud.js
---
assets/js/concise/CRUD.js | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/assets/js/concise/CRUD.js b/assets/js/concise/CRUD.js
index 2bbe11a..ab60c8d 100644
--- a/assets/js/concise/CRUD.js
+++ b/assets/js/concise/CRUD.js
@@ -12,6 +12,7 @@
this.error = window.jvbError;
this.populate = window.jvbPopulate;
this.cache = new window.jvbCache(this.content);
+ this.uploadedFields = new Set(); //tracks which upload fields are currently uploading; so don't send any of these changes to server
this.activeItem = null;
this.isTimeline = false;
@@ -350,6 +351,21 @@
});
}
}
+
+ if (event === 'sent-to-queue' && data.field) {
+ const fieldName = data.field.config.name;
+ const itemId = data.field.config.itemID;
+ if (itemId && fieldName) {
+ this.uploadedFields.add(`${itemId}_${fieldName}`);
+ if (this.changes.has(itemId)) {
+ delete this.changes.get(itemId)[fieldName];
+ }
+ }
+ }
+
+ if (event === 'upload_complete') {
+ this.uploadedFields.delete(`${data['item_id']}_${data['field']}`);
+ }
});
}
initModals() {
@@ -807,6 +823,13 @@
}
this.changes.get(itemId)[name] = value;
+ for (const key of this.uploadedFields) {
+ const [itemId, fieldName] = key.split('_');
+ if (this.changes.has(itemId)) {
+ delete this.changes.get(itemId)[fieldName];
+ }
+ }
+
this.scheduleBackup();
//Only send actual itemIds to server. If this is a recently uploaded item, just store changes for now
if (typeof itemId === 'number' || !itemId.includes('group')) {
--
Gitblit v1.10.0