A local-first personal finance app
fix nuisance timestamp error in API (#5759)
Matt Fiddaman59724d445f6a
diff --git a/packages/api/index.ts b/packages/api/index.tsindex 8fa8577eb9..4caffc5ea9 100644--- a/packages/api/index.ts+++ b/packages/api/index.ts@@ -42,7 +42,11 @@ export async function init(config: InitConfig = {}) {export async function shutdown() {if (actualApp) {- await actualApp.send('sync');+ try {+ await actualApp.send('sync');+ } catch (e) {+ // most likely that no budget is loaded, so the sync failed+ }await actualApp.send('close-budget');actualApp = null;}diff --git a/packages/loot-core/src/server/sync/index.ts b/packages/loot-core/src/server/sync/index.tsindex 8fa8976790..5b65124dda 100644--- a/packages/loot-core/src/server/sync/index.ts+++ b/packages/loot-core/src/server/sync/index.ts@@ -625,11 +625,20 @@ async function _fullSync(count: number,prevDiffTime: number,): Promise<Message[]> {- const { cloudFileId, groupId, lastSyncedTimestamp } = prefs.getPrefs() || {};+ const {+ id: currentId,+ cloudFileId,+ groupId,+ lastSyncedTimestamp,+ } = prefs.getPrefs() || {};clearFullSyncTimeout();- if (checkSyncingMode('disabled') || checkSyncingMode('offline')) {+ if (+ checkSyncingMode('disabled') ||+ checkSyncingMode('offline') ||+ !currentId+ ) {return [];}diff --git a/upcoming-release-notes/5759.md b/upcoming-release-notes/5759.mdnew file mode 100644index 0000000000..129a0ba042--- /dev/null+++ b/upcoming-release-notes/5759.md@@ -0,0 +1,6 @@+---+category: Bugfix+authors: [matt-fidd]+---++Fix timestamp error when shutting down API with no budget loaded