From 9efc82ce50738bb5595edaa95404bcd416ad87f3 Mon Sep 17 00:00:00 2001 From: Val Packett Date: Wed, 24 Aug 2022 17:04:15 +0300 Subject: [PATCH] Plugin: be resilient against lastSync getting corrupted in the DB --- plugins/tiddlypwa/main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/tiddlypwa/main.js b/plugins/tiddlypwa/main.js index 2d0a5f7..2358c63 100644 --- a/plugins/tiddlypwa/main.js +++ b/plugins/tiddlypwa/main.js @@ -222,7 +222,7 @@ Formatted with `deno fmt`. key: cursor.key, url, token, - lastSync: lastSync.getTime() === 0 ? 'never' : lastSync.toLocaleString(), + lastSync: lastSync?.getTime() === 0 ? 'never' : lastSync?.toLocaleString(), }); cursor.continue(); } @@ -594,7 +594,7 @@ Formatted with `deno fmt`. } } - async _syncOneUnlocked({ url, token, lastSync }, all = false, now = new Date()) { + async _syncOneUnlocked({ url, token, lastSync = new Date(0) }, all = false, now = new Date()) { this.logger.log('sync started', url, lastSync, all, now); this.wiki.addTiddler({ title: '$:/status/TiddlyPWASyncingWith', text: url }); const changes = [];