You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: improve resolve performance by solving merge abstract nodes in postprocessing (#826)
Previously, we've generated too many fields for abstract nodes. This
meant that after resolving, we had to deduplicate and merge some fields.
This new approach solves the problem in a post processing step as part
of the planning. This means that the runtime does less work during
resolving, and a little bit more work during planning, which gets cached
anyways.
---------
Co-authored-by: Sergiy 🇺🇦 <818351+devsergiy@users.noreply.github.com>
assert.Equal(t, `{"data":{"topProducts":[{"name":"Trilby","reviews":[{"body":"A highly effective form of birth control.","author":{"username":"Me"}}]},{"name":"Fedora","reviews":[{"body":"Fedoras are one of the most fashionable hats around and can look great with a variety of outfits.","author":{"username":"Me"}}]}]}}`, string(resp))
99
102
})
100
103
101
104
t.Run("mutation operation with variables", func(t*testing.T) {
assert.Equal(t, `{"data":{"me":{"username":"Me","history":[{"wallet":{"amount":123,"specialField1":"some special value 1"}},{"rating":5},{"wallet":{"amount":123,"specialField2":"some special value 2"}}]}}}`, string(resp))
118
136
})
119
137
120
138
t.Run("subscription query through WebSocket transport", func(t*testing.T) {
"body": "The best hat I have ever bought in my life."
407
-
},
408
-
{
409
-
"upc": "top-2",
410
-
"size": 13.37
411
-
}
412
-
]
413
-
}
414
-
]
415
-
}
416
-
}
417
-
}
418
-
`
409
+
expected:=`{"data":{"me":{"id":"1234","username":"Me","history":[{"wallet":{"currency":"USD"}},{"location":"Germany","product":{"upc":"top-2","name":"Fedora"}},{"wallet":{"currency":"USD"}}],"reviews":[{"__typename":"Review","attachments":[{"__typename":"Question","upc":"top-1","body":"How do I turn it on?"}]},{"__typename":"Review","attachments":[{"__typename":"Rating","upc":"top-2","body":"The best hat I have ever bought in my life."},{"__typename":"Video","upc":"top-2","size":13.37}]}]}}}`
419
410
assert.Equal(t, compact(expected), string(resp))
420
411
})
421
412
422
-
t.Run("Merged fields are still resolved", func(t*testing.T) {
expected:=`{"data":{"me":{"id":"1234","username":"Me","history":[{"wallet":{"currency":"USD"}},{"location":"Germany","product":{"name":"Fedora","upc":"top-2"}},{"wallet":{"currency":"USD"}}],"reviews":[{"__typename":"Review","attachments":[{"__typename":"Question","upc":"top-1","body":"How do I turn it on?"}],"comment":{"__typename":"Question","subject":"Life"}},{"__typename":"Review","attachments":[{"__typename":"Rating","upc":"top-2","body":"The best hat I have ever bought in my life."},{"__typename":"Video","upc":"top-2","size":13.37}],"comment":{"__typename":"Question","subject":"Life"}}]}}}`
expected:=`{"data":{"me":{"id":"1234","username":"Me","history":[{"wallet":{"currency":"USD"}},{"location":"Germany","product":{"name":"Fedora","upc":"top-2"}},{"wallet":{"currency":"USD"}}],"reviews":[{"__typename":"Review","attachments":[{"__typename":"Question","upc":"top-1","body":"How do I turn it on?"}]},{"__typename":"Review","attachments":[{"__typename":"Rating","upc":"top-2","body":"The best hat I have ever bought in my life."},{"__typename":"Video","upc":"top-2","size":13.37}]}]}}}`
"body": "A highly effective form of birth control."
440
-
},
441
-
{
442
-
"body": "Fedoras are one of the most fashionable hats around and can look great with a variety of outfits."
443
-
}
444
-
],
445
-
"history": [
446
-
{},
447
-
{
448
-
"rating": 5
449
-
},
450
-
{}
451
-
]
452
-
}
453
-
}
454
-
}`
492
+
expected:=`{"data":{"cat":{"name":"Pepper"},"me":{"id":"1234","username":"Me","realName":"User Usington","reviews":[{"body":"A highly effective form of birth control."},{"body":"Fedoras are one of the most fashionable hats around and can look great with a variety of outfits."}],"history":[{},{"rating":5},{}]}}}`
0 commit comments