Skip to content

Commit

Permalink
Fix cache key generation for arrays by calling orderIndependentKey fo…
Browse files Browse the repository at this point in the history
…r each element
  • Loading branch information
Dieter Eberle committed Jul 1, 2020
1 parent 3fb1b05 commit 1ba9098
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 1ba9098

Please sign in to comment.