Skip to content

Commit 1ba9098

Browse files
author
Dieter Eberle
committed
Fix cache key generation for arrays by calling orderIndependentKey for each element
1 parent 3fb1b05 commit 1ba9098

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)