Skip to content

Conversation

@mikaelkaron
Copy link
Contributor

@mikaelkaron mikaelkaron commented Nov 4, 2025

  • Fix null handling in copyObjectByKeys so recursion only happens on real objects, preventing crashes when merging nullable GraphQL relationships.
  • Make mergeResult resilient to partial result trees via resolveResultPath, ensuring nested entity merges land on the correct container even when parents are missing.
  • Normalize resolver payloads in toArgsAdapterInput with deep flattening so adapters receive every upstream ID, keeping alternating singer chains populated.
  • Add comprehensive regression coverage: new singer loop scenarios in on-subgraphs-3.test.js and a dedicated utils-copy-object-by-keys.test.js suite.

Fixes: #70

Signed-off-by: Mikael Karon <mikael@karon.se>
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>
@mikaelkaron mikaelkaron force-pushed the mikaelkaron-nesting-null branch from eaf1bf2 to e77178e Compare November 4, 2025 21:36
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>
@mikaelkaron mikaelkaron changed the title Mikaelkaron nesting null fix: graphql-composer sometimes returns null when nesting Nov 4, 2025
@mikaelkaron mikaelkaron changed the title fix: graphql-composer sometimes returns null when nesting fix: graphql-composer sometimes returns null when nesting Nov 5, 2025
@mikaelkaron mikaelkaron marked this pull request as ready for review November 5, 2025 00:03
…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>
@mikaelkaron mikaelkaron force-pushed the mikaelkaron-nesting-null branch from 8d72c46 to 5a69182 Compare November 5, 2025 00:45
…s purpose and return type

Signed-off-by: Mikael Karon <mikael@karon.se>
@mikaelkaron mikaelkaron changed the title fix: graphql-composer sometimes returns null when nesting fix: graphql-composer sometimes returns null when nesting Nov 5, 2025
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mcollina mcollina merged commit 60014e3 into platformatic:main Nov 5, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

graphql-composer sometimes returns null when nesting

2 participants