Skip to content

Commit a61e96a

Browse files
committed
Fixing save item crash
1 parent 4d2be51 commit a61e96a

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

Modules/Skypiea/Sources/Skypiea/Protocols/Cloudable.swift

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,21 @@ extension Cloudable {
8282
throw error
8383
}
8484

85+
let decodedItems = items
86+
.compactMap(fromRecord(_:))
87+
8588
if let limit = limit {
86-
return items
87-
.compactMap(fromRecord(_:))
89+
if decodedItems.count < limit {
90+
return decodedItems
91+
.asArray()
92+
}
93+
94+
return decodedItems
8895
.prefix(upTo: limit)
8996
.asArray()
9097
}
9198

92-
return items
93-
.compactMap(fromRecord(_:))
99+
return decodedItems
94100
}
95101

96102
/// Finds a record by the given record.

Tasktive/Views/Screens/TasksScreen.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,8 @@ struct TasksScreen: View {
248248
}
249249

250250
private func handleOnAppear() {
251-
if viewModel.currentSource == .iCloud, !userData.iCloudSyncingIsEnabled {
251+
if viewModel.currentSource == .iCloud,
252+
!userData.iCloudSyncingIsEnabled || !Environment.Features.iCloudSyncing {
252253
viewModel.currentSource = .coreData
253254
}
254255

0 commit comments

Comments
 (0)