aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client/views/nodes/TaskBox.tsx10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/client/views/nodes/TaskBox.tsx b/src/client/views/nodes/TaskBox.tsx
index 5f46c9b2c..d29160e02 100644
--- a/src/client/views/nodes/TaskBox.tsx
+++ b/src/client/views/nodes/TaskBox.tsx
@@ -239,7 +239,7 @@ export class TaskBox extends ViewBoxBaseComponent<FieldViewProps>() {
};
/**
- * Method to sync the task with Google Tasks bidirectionally
+ * Method to sync the task with Google Tasks bidirectionally
* (update Dash from Google and vice versa, based on which is newer)
* @param silent - whether to suppress UI prompts to connect to Google (default: false)
* @returns - a promise that resolves to true if sync was successful, false otherwise
@@ -290,7 +290,10 @@ export class TaskBox extends ViewBoxBaseComponent<FieldViewProps>() {
const googleUpdated = new Date(googleTask.updated);
const dashUpdated = new Date(StrCast(doc.$task_lastSyncedAt));
- if (googleUpdated > dashUpdated) {
+ const dashChanged =
+ StrCast(doc.title) !== this._lastSyncedTask.title || StrCast(doc[this.fieldKey]) !== this._lastSyncedTask.text || this.computeDueDate() !== this._lastSyncedTask.due || !!doc.$task_completed !== this._lastSyncedTask.completed;
+
+ if (googleUpdated > dashUpdated && !dashChanged) {
// Google version is newer — update Dash
runInAction(() => {
doc.title = googleTask.title ?? doc.title;
@@ -315,6 +318,9 @@ export class TaskBox extends ViewBoxBaseComponent<FieldViewProps>() {
console.log('Pulled newer version from Google');
return true;
+ } else if (googleUpdated <= dashUpdated && !dashChanged) {
+ console.log('No changes to sync');
+ return true;
} else {
// Dash version is newer — push update to Google
const body = this.buildGoogleTaskBody();