Skip to content

Commit eefd05c

Browse files
authored
Merge pull request #70 from zhigang1992/fix/removeAll
Fix: Strategy based removal on insert operates on all items rather than just inserted items
2 parents 110becf + f9f2885 commit eefd05c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Sources/Boutique/Store.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ internal extension Store {
335335
var currentItems = self.items
336336

337337
if let strategy = existingItemsStrategy {
338-
var removedItems = [item]
338+
var removedItems = currentItems
339339
try await self.removeItemsFromStorageEngine(&removedItems, withStrategy: strategy)
340340
// If we remove this one it will error
341341
self.removeItemsFromMemory(&currentItems, withStrategy: strategy, identifier: cacheIdentifier)
@@ -360,7 +360,7 @@ internal extension Store {
360360

361361
if let strategy = existingItemsStrategy {
362362
// Remove items from disk and memory based on the cache invalidation strategy
363-
var removedItems = items
363+
var removedItems = currentItems
364364
try await self.removeItemsFromStorageEngine(&removedItems, withStrategy: strategy)
365365
// This one is fine to remove... but why?
366366
// Is it the way we construct the items in the ordered dictionary?

0 commit comments

Comments
 (0)