diff --git a/lib/src/main/java/graphql/nadel/result/NadelResultTracker.kt b/lib/src/main/java/graphql/nadel/result/NadelResultTracker.kt index 8aaee080b..905a8dbbb 100644 --- a/lib/src/main/java/graphql/nadel/result/NadelResultTracker.kt +++ b/lib/src/main/java/graphql/nadel/result/NadelResultTracker.kt @@ -20,6 +20,21 @@ internal class NadelResultTracker { DeadEnd, } + /** + * So… in Nadel the result can change a lot. + * + * This function lets you track where a result node went to in the overall response sent to the user. + * + * I haven't benchmarked this yet, but in theory it should be more performant than say using + * [graphql.nadel.engine.transform.result.json.JsonNodes]. + * + * In the past we used to track the [NadelResultPathSegment]s for each [JsonNode] but that was horrible + * performance wise because we created one List for each result node + * i.e. as the result grew, both in depth and result node count, you'd allocate tons of (big) lists. + * + * This implementation keeps track of the _current_ [NadelResultPathSegment]s and returns that if it + * finds the [node] in question. + */ suspend fun getResultPath( queryPath: NadelQueryPath, node: JsonNode,