Skip to content

[Fusion] Fix null being returned for batch item - #8383

Merged
michaelstaib merged 2 commits into
main-version-15from
tte/fix-fusion-null-items-in-batchstate
Jun 25, 2025
Merged

michaelstaib merged 2 commits into
main-version-15from
tte/fix-fusion-null-items-in-batchstate

Conversation

@tobias-tengler

@tobias-tengler tobias-tengler commented Jun 25, 2025 •

Copy link
Copy Markdown
Member

Given the following query

query {
  userBySlug(slug: "me") { # Subgraph 1
    feedbacks { # Subgraph 2
      edges {
        node {
          feedback {
            buyer {
              relativeUrl # Subgraph 1
              displayName # Subgraph 3
            }
          }
        }
      }
    }
  }
}

The Gateway will first go to Subgaph 1 to retrieve the User Entity, then it will go to Subgraph 2 to retrieve the list of Feedbacks, where each feedback is associated with another User.
For each User the Gateway should go to Subgraph 1 and Subgraph 3 in parallel to retrieve the necessary information.
However it creates a sequential query plan where it first does a batch call to Subgraph 1 and then with the results from Subgraph 1 a batch call to Subgraph 3. This is another issue though and I deemed it not worth fixing with Fusion v2 around the corner.

What this PR is addressing is the case if the batch call to Subgraph 1 returns null for some of the items being requested. This currently leads to an exception when building the variables necessary for the second batch call to Subgraph 3.
This exception will cause the requested fields from Subgraph 3 to be null for all User entities.

This PR makes it so that successful batch items are not affected by a missing one.
The effect of the fix can be seen in this diff: 7e240d8#diff-e3ebe93626ac479da605def8dda43ed76779f46f685c83342add3513c107ea03

@tobias-tengler
tobias-tengler force-pushed the tte/fix-fusion-null-items-in-batchstate branch from 0e6d376 to 7e240d8 Compare June 25, 2025 10:05
@tobias-tengler
tobias-tengler marked this pull request as ready for review June 25, 2025 10:08
@michaelstaib
michaelstaib merged commit ecb937c into main-version-15 Jun 25, 2025
@michaelstaib
michaelstaib deleted the tte/fix-fusion-null-items-in-batchstate branch June 25, 2025 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants