Skip to content

Commit

Permalink
Merge pull request #1281 from sprylab/fix_cache_key_for_arrays
Browse files Browse the repository at this point in the history
Fix cache key generation for arrays by calling orderIndependentKey fo…
  • Loading branch information
designatednerd authored Jul 8, 2020
2 parents 1200857 + 1ba9098 commit c41c185
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Sources/Apollo/GraphQLSelectionSet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ private func orderIndependentKey(for object: JSONObject) -> String {
return object.sorted { $0.key < $1.key }.map {
if let object = $0.value as? JSONObject {
return "[\($0.key):\(orderIndependentKey(for: object))]"
} else if let array = $0.value as? [JSONObject] {
return "\($0.key):[\(array.map { orderIndependentKey(for: $0) }.joined(separator: ","))]"
} else {
return "\($0.key):\($0.value)"
}
Expand Down

0 comments on commit c41c185

Please sign in to comment.