From 987e75c9cf720e97aea59b458d00312b9b657b23 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Wed, 11 Feb 2026 02:16:37 +0000
Subject: [PATCH] =attempt to debug why content_update gets called after upload completes

---
 assets/js/concise/CRUD.js |   21 ++++++++++++++++++---
 1 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/assets/js/concise/CRUD.js b/assets/js/concise/CRUD.js
index ab60c8d..1dba72a 100644
--- a/assets/js/concise/CRUD.js
+++ b/assets/js/concise/CRUD.js
@@ -830,6 +830,14 @@
 			}
 		}
 
+		// Don't schedule if only base keys remain
+		const change = this.changes.get(itemId);
+		const realKeys = Object.keys(change).filter(k => k !== 'id' && k !== 'content');
+		if (realKeys.length === 0) {
+			this.changes.delete(itemId);
+			return;
+		}
+
 		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')) {
@@ -1266,10 +1274,17 @@
 
 		changes.forEach(change => {
 			let itemId = change.id;
+			const { id, content, ...fields } = change;
 
-			// Create a new object without the id field (don't mutate original!)
-			const { id, ...changeWithoutId } = change;
-			allChanges[itemId] = changeWithoutId;
+			// Filter out uploaded fields
+			for (const key of this.uploadedFields) {
+				const [uid, fieldName] = key.split('_');
+				if (uid === itemId) delete fields[fieldName];
+			}
+
+			if (Object.keys(fields).length > 0) {
+				allChanges[itemId] = { content, ...fields };
+			}
 
 			if (change.post_status && this.shouldRemoveItemUI(change.post_status)) {
 				remove.push(itemId);

--
Gitblit v1.10.0