ctucx.git: trainsearch

web based trip-planner, fork of https://cyberchaos.dev/yuka/trainsearch

commit 9c8af971a703a99a53f3e543d0799478e5f9f72c
parent bcf9069335e50346e205b8cdb72dfbb12e249b2d
Author: Katja (ctucx) <git@ctu.cx>
Date: Thu, 30 Jan 2025 13:31:47 +0100

dataStorage: fix history-entry duplication
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/dataStorage.js b/src/dataStorage.js
@@ -83,8 +83,11 @@ class IDBStorage {
 		let proms = journeyEntries.map(j => {
 			journeyStore.put(j);
 		});
+
+		if (overviewEntry.historyEntryId === undefined)
+			overviewEntry.historyEntryId = await journeysHistoryStore.put(historyEntry);
+
 		proms.push(journeysOverviewStore.put(overviewEntry));
-		proms.push(journeysHistoryStore.put(historyEntry));
 		proms.push(tx.done);
 		await Promise.all(proms);
 	}