-
Notifications
You must be signed in to change notification settings - Fork 6
fix: graphql-composer sometimes returns null when nesting
#80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
mcollina
merged 14 commits into
platformatic:main
from
mikaelkaron:mikaelkaron-nesting-null
Nov 5, 2025
Merged
fix: graphql-composer sometimes returns null when nesting
#80
mcollina
merged 14 commits into
platformatic:main
from
mikaelkaron:mikaelkaron-nesting-null
Nov 5, 2025
Conversation
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
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
mcollina
approved these changes
Nov 5, 2025
Member
mcollina
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
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