File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
Modules/Sources/Yosemite/SnapshotsProvider
WooCommerce/Classes/ViewRelated/Orders Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -179,6 +179,16 @@ public final class FetchResultSnapshotsProvider<MutableType: FetchResultSnapshot
179179 return nil
180180 }
181181 }
182+
183+ /// The lightweight version of `object(withID:)` method. Returns readonly objects without relationships.
184+ ///
185+ public func lightweightObject( withID objectID: FetchResultSnapshotObjectID ) -> MutableType . ReadOnlyType ? {
186+ if let storageOrder = storage. loadObject ( ofType: MutableType . self, with: objectID) {
187+ return storageOrder. toLightweightReadOnly ( )
188+ } else {
189+ return nil
190+ }
191+ }
182192}
183193
184194// MARK: - FetchedResultsController Activation
Original file line number Diff line number Diff line change @@ -326,7 +326,7 @@ extension OrderListViewModel {
326326
327327 /// Creates an `OrderListCellViewModel` for the `Order` pointed to by `objectID`.
328328 func cellViewModel( withID objectID: FetchResultSnapshotObjectID ) -> OrderListCellViewModel ? {
329- guard let order = snapshotsProvider. object ( withID: objectID) else {
329+ guard let order = snapshotsProvider. lightweightObject ( withID: objectID) else {
330330 return nil
331331 }
332332
You can’t perform that action at this time.
0 commit comments