Skip to content

Commit c41c185

Browse files
Merge pull request #1281 from sprylab/fix_cache_key_for_arrays
Fix cache key generation for arrays by calling orderIndependentKey fo…
2 parents 1200857 + 1ba9098 commit c41c185

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

Sources/Apollo/GraphQLSelectionSet.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ private func orderIndependentKey(for object: JSONObject) -> String {
8989
return object.sorted { $0.key < $1.key }.map {
9090
if let object = $0.value as? JSONObject {
9191
return "[\($0.key):\(orderIndependentKey(for: object))]"
92+
} else if let array = $0.value as? [JSONObject] {
93+
return "\($0.key):[\(array.map { orderIndependentKey(for: $0) }.joined(separator: ","))]"
9294
} else {
9395
return "\($0.key):\($0.value)"
9496
}

0 commit comments

Comments
 (0)