From 0cc44f46f23eede1d427b6ee77d8826117d95acb Mon Sep 17 00:00:00 2001 From: Laurent Date: Sun, 30 Jun 2024 19:46:36 +0200 Subject: [PATCH] Fix migration --- LeStorage/Store.swift | 2 +- LeStorage/StoredCollection.swift | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/LeStorage/Store.swift b/LeStorage/Store.swift index b47b021..c295f57 100644 --- a/LeStorage/Store.swift +++ b/LeStorage/Store.swift @@ -211,7 +211,7 @@ open class Store { } self._validIds.append(contentsOf: filtered.map { $0.stringId }) - try? collection.addOrUpdate(contentOfs: filtered) + try? collection.addOrUpdateNoSync(contentOfs: filtered) Logger.log("Migrated \(filtered.count) \(T.resourceName())") } diff --git a/LeStorage/StoredCollection.swift b/LeStorage/StoredCollection.swift index 1d7d10c..32d4d57 100644 --- a/LeStorage/StoredCollection.swift +++ b/LeStorage/StoredCollection.swift @@ -304,6 +304,10 @@ public class StoredCollection: RandomAccessCollection, SomeCollecti try self._addOrUpdate(contentOfs: sequence) } + func addOrUpdateNoSync(contentOfs sequence: any Sequence) throws { + try self._addOrUpdate(contentOfs: sequence, shouldSync: false) + } + /// Inserts or updates all items in the sequence fileprivate func _addOrUpdate(contentOfs sequence: any Sequence, shouldSync: Bool = true) throws { defer {