[ApolloPagination] Update variable mapping logic to use a Set instead of an Array #260
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A special thank you to @ralph-101-dev for finding this issue in a pre-release build of
ApolloPagination
.Closes apollographql/apollo-ios#3331
This pull request primarily focuses on modifying how variables are handled in
AsyncGraphQLQueryPagerCoordinator.swift
. The changes involve altering the data types of variables from arrays to sets, which should eliminate the possibility of a mismatch between mis-ordered array outputs. This is especially needed, because the underlying values being pulled from are an unordered dictionary, so multiple invocations of the same function can result in a key-miss.The change to production code is a one-liner: We've updated the value of the
variables
variable – which houses the input variables of a givenGraphQLQuery
– from anArray<JSONValue
to aSet<JSONValue
.The tests were updated to unwrap the
AnyHashable
key-value of thenextPageVarMap
property as aSet
instead of as anArray
. Notably, the tests were masking this error, as they were previously taking theArray
outputs, wrapping them in aSet
, and then comparing the sets!