fix: graphql-composer sometimes returns null when nesting#80
Merged
mcollina merged 14 commits intoNov 5, 2025
Conversation
Signed-off-by: Mikael Karon <mikael@karon.se>
1e8e79f to
eaf1bf2
Compare
This fix addresses a critical bug where copyObjectByKeys would attempt to recurse into null values due to JavaScript's typeof null === 'object' quirk. The function now explicitly checks for null before recursion. Also includes comprehensive test suite for copyObjectByKeys and adds a test case documenting issue platformatic#70 (currently skipped as it requires architectural changes to support entity resolution for entities nested within entity resolver results). Related to platformatic#70 Signed-off-by: Mikael Karon <mikael@karon.se>
eaf1bf2 to
e77178e
Compare
Signed-off-by: Mikael Karon <mikael@karon.se>
Signed-off-by: Mikael Karon <mikael@karon.se>
Signed-off-by: Mikael Karon <mikael@karon.se>
…l values Signed-off-by: Mikael Karon <mikael@karon.se>
null when nesting
…geResult` function Signed-off-by: Mikael Karon <mikael@karon.se>
…d consolidating loops Signed-off-by: Mikael Karon <mikael@karon.se>
… and for-of loop Signed-off-by: Mikael Karon <mikael@karon.se>
…ing and improving performance Signed-off-by: Mikael Karon <mikael@karon.se>
…ts` and using `flat` method directly Signed-off-by: Mikael Karon <mikael@karon.se>
…ogic Signed-off-by: Mikael Karon <mikael@karon.se>
8d72c46 to
5a69182
Compare
…s purpose and return type Signed-off-by: Mikael Karon <mikael@karon.se>
null when nestinggraphql-composer sometimes returns null when nesting
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
copyObjectByKeysso recursion only happens on real objects, preventing crashes when merging nullable GraphQL relationships.mergeResultresilient to partial result trees viaresolveResultPath, ensuring nested entity merges land on the correct container even when parents are missing.toArgsAdapterInputwith deep flattening so adapters receive every upstream ID, keeping alternatingsingerchains populated.singerloop scenarios inon-subgraphs-3.test.jsand a dedicatedutils-copy-object-by-keys.test.jssuite.Fixes: #70