Skip to content

Commit 702ca34

Browse files
authored
fix: Querying using findAll may return inacurrate results (#162)
* fix: Querying using findAll may return inacurrate results * nit * try watchOS test * revert
1 parent 0485a6b commit 702ca34

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

CHANGELOG.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,16 @@
22
# Parse-Swift Changelog
33

44
### main
5-
[Full Changelog](https://github.com/netreconlab/Parse-Swift/compare/5.9.1...main), [Documentation](https://swiftpackageindex.com/netreconlab/Parse-Swift/main/documentation/parseswift)
5+
[Full Changelog](https://github.com/netreconlab/Parse-Swift/compare/5.9.2...main), [Documentation](https://swiftpackageindex.com/netreconlab/Parse-Swift/main/documentation/parseswift)
66
* _Contributing to this repo? Add info about your change here to be included in the next release_
77

88

9+
### 5.9.2
10+
[Full Changelog](https://github.com/netreconlab/Parse-Swift/compare/5.9.1...5.9.2), [Documentation](https://swiftpackageindex.com/netreconlab/Parse-Swift/5.9.2/documentation/parseswift)
11+
12+
__Fixes__
13+
* Querying using findAll may be inacurrate when results are greater than the batch limit ([#161](https://github.com/netreconlab/Parse-Swift/pull/161)), thanks to [Corey Baker](https://github.com/cbaker6).
14+
915
### 5.9.1
1016
[Full Changelog](https://github.com/netreconlab/Parse-Swift/compare/5.9.0...5.9.1), [Documentation](https://swiftpackageindex.com/netreconlab/Parse-Swift/5.9.1/documentation/parseswift)
1117

Sources/ParseSwift/ParseConstants.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import Foundation
1010

1111
enum ParseConstants {
1212
static let sdk = "swift"
13-
static let version = "5.9.1"
13+
static let version = "5.9.2"
1414
static let fileManagementDirectory = "parse/"
1515
static let fileManagementPrivateDocumentsDirectory = "Private Documents/"
1616
static let fileManagementLibraryDirectory = "Library/"

Sources/ParseSwift/Types/Query.swift

+3-1
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,7 @@ extension Query: Queryable {
584584
var query = self
585585
.order([.ascending("objectId")])
586586
query.limit = limit ?? ParseConstants.batchLimit
587+
let originalQueryWhere = query.where
587588
var results = [ResultType]()
588589
var finished = false
589590
while !finished {
@@ -593,8 +594,9 @@ extension Query: Queryable {
593594
results.append(contentsOf: currentResults)
594595
if currentResults.count >= query.limit {
595596
guard let lastObjectId = results[results.count - 1].objectId else {
596-
throw ParseError(code: .otherCause, message: "Last object should have an id.")
597+
throw ParseError(code: .otherCause, message: "Last object should have an objectId.")
597598
}
599+
query.where = originalQueryWhere
598600
query.where.add("objectId" > lastObjectId)
599601
} else {
600602
finished = true

0 commit comments

Comments
 (0)