diff options
| author | Fuwn <[email protected]> | 2025-06-27 19:48:19 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2025-06-27 19:48:19 -0700 |
| commit | db03724530f53d29cffe7093d6c94cff69f69b62 (patch) | |
| tree | a19cfcba8d82c29b596c22d94ab43e9c9e89c0a2 | |
| parent | feat: Development commit (diff) | |
| download | sora-testing-db03724530f53d29cffe7093d6c94cff69f69b62.tar.xz sora-testing-db03724530f53d29cffe7093d6c94cff69f69b62.zip | |
feat: Development commit
| -rw-r--r-- | Sora/Data/Booru/BooruManager.swift | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/Sora/Data/Booru/BooruManager.swift b/Sora/Data/Booru/BooruManager.swift index be78688..6f4bc1f 100644 --- a/Sora/Data/Booru/BooruManager.swift +++ b/Sora/Data/Booru/BooruManager.swift @@ -313,15 +313,13 @@ class BooruManager: ObservableObject { // swiftlint:disable:this type_body_leng await MainActor.run { withTransaction(Transaction(animation: nil)) { - self.posts += chunk + let oldCount = self.posts.count - let startIndex = self.posts.count + self.posts += chunk - self.postIndexMap = Dictionary( - uniqueKeysWithValues: chunk.enumerated().map { offset, post in - (post.id, startIndex + offset) - } - ) + for (offset, post) in chunk.enumerated() { + self.postIndexMap[post.id] = oldCount + offset + } } } } |