René's URL Explorer Experiment


Title: Nested @defer fragment is delivered before the fragment that contains it · Issue #4567 · graphql-java/graphql-java · GitHub

Open Graph Title: Nested @defer fragment is delivered before the fragment that contains it · Issue #4567 · graphql-java/graphql-java

X Title: Nested @defer fragment is delivered before the fragment that contains it · Issue #4567 · graphql-java/graphql-java

Description: Describe the bug With incremental support on, a @defer nested under a field of another @defer is delivered before the fragment that contains it. The child payload's path points at an object that the client has not received yet. The paren...

Open Graph Description: Describe the bug With incremental support on, a @defer nested under a field of another @defer is delivered before the fragment that contains it. The child payload's path points at an object that th...

X Description: Describe the bug With incremental support on, a @defer nested under a field of another @defer is delivered before the fragment that contains it. The child payload's path points at an object tha...

Opengraph URL: https://github.com/graphql-java/graphql-java/issues/4567

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Nested @defer fragment is delivered before the fragment that contains it","articleBody":"### Describe the bug\n\nWith incremental support on, a `@defer` nested under a field of another `@defer` is delivered **before** the fragment that contains it. The child payload's `path` points at an object that the client has not received yet. The parent payload then delivers that object as `{}`.\n\nThe incremental delivery working group decided that a nested deferred fragment must not be delivered before its parent ([graphql/defer-stream-wg#17](https://github.com/graphql/defer-stream-wg/discussions/17)). A client that applies payloads in order can lose the child's data: the parent's `inner: {}` arrives last and can replace what the child payload wrote.\n\nReproduced on 26.1 and 26.2, with `enableEarlyIncrementalFieldExecution` on and off, in every run.\n\n### To reproduce\n\nQuery, with `slow` resolving after 300 ms and every other field at once:\n\n```graphql\n{\n  obj {\n    fast\n    ... @defer(label: \"parent\") {\n      slow\n      inner { ... @defer(label: \"child\") { fast } }\n    }\n  }\n}\n```\n\nOutput of the program below on 26.2:\n\n```\ngraphql-java from graphql-java-26.2.jar\nenableEarlyIncrementalFieldExecution=false\n    61 ms  initial  {obj={fast=obj-fast}}\n    73 ms  child    path=[obj, inner]  {fast=inner-fast}\n   369 ms  parent   path=[obj]  {slow=obj-slow, inner={}}\n  order [child, parent]  child delivered before its parent\nenableEarlyIncrementalFieldExecution=true\n     2 ms  initial  {obj={fast=obj-fast}}\n     2 ms  child    path=[obj, inner]  {fast=inner-fast}\n   302 ms  parent   path=[obj]  {slow=obj-slow, inner={}}\n  order [child, parent]  child delivered before its parent\n```\n\nExpected: `parent` before `child`, or both in one payload with `parent` first.\n\nRun it with JDK 17 or later, with graphql-java, java-dataloader 6.0.0, reactive-streams 1.0.3 and jspecify 1.0.0 on the class path:\n\n```\njava -cp graphql-java-26.2.jar:java-dataloader-6.0.0.jar:reactive-streams-1.0.3.jar:jspecify-1.0.0.jar NestedDeferOrderRepro.java\n```\n\nIt exits with status 1 when the child is delivered first.\n\n\u003cdetails>\u003csummary>NestedDeferOrderRepro.java\u003c/summary>\n\n```java\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.concurrent.CompletableFuture;\nimport java.util.concurrent.CountDownLatch;\nimport java.util.concurrent.Executors;\nimport java.util.concurrent.ScheduledExecutorService;\nimport java.util.concurrent.TimeUnit;\n\nimport graphql.ExecutionInput;\nimport graphql.GraphQL;\nimport graphql.incremental.DelayedIncrementalPartialResult;\nimport graphql.incremental.IncrementalExecutionResult;\nimport graphql.incremental.IncrementalPayload;\nimport graphql.schema.DataFetcher;\nimport graphql.schema.GraphQLSchema;\nimport graphql.schema.idl.RuntimeWiring;\nimport graphql.schema.idl.SchemaGenerator;\nimport graphql.schema.idl.SchemaParser;\nimport org.reactivestreams.Subscriber;\nimport org.reactivestreams.Subscription;\n\n/**\n * A @defer nested under a field of another @defer is delivered before the fragment that contains it.\n *\n * The outer fragment (\"parent\") selects a field that resolves after 300 ms and a field \"inner\"\n * whose only selection is the nested fragment (\"child\"). The child's field resolves at once.\n * Expected: \"parent\" before \"child\", as graphql-js does and as the incremental delivery working\n * group decided (https://github.com/graphql/defer-stream-wg/discussions/17).\n */\npublic class NestedDeferOrderRepro {\n  static final String SDL = String.join(\"\\n\",\n      \"directive @defer(if: Boolean! = true, label: String) on FRAGMENT_SPREAD | INLINE_FRAGMENT\",\n      \"type Query { obj: Obj }\",\n      \"type Obj { fast: String slow: String inner: Inner }\",\n      \"type Inner { fast: String }\");\n\n  static final String QUERY = String.join(\"\\n\",\n      \"{\",\n      \"  obj {\",\n      \"    fast\",\n      \"    ... @defer(label: \\\"parent\\\") {\",\n      \"      slow\",\n      \"      inner { ... @defer(label: \\\"child\\\") { fast } }\",\n      \"    }\",\n      \"  }\",\n      \"}\");\n\n  static final ScheduledExecutorService SCHEDULER = Executors.newScheduledThreadPool(2);\n\n  static \u003cT> CompletableFuture\u003cT> after(long delayMs, T value) {\n    CompletableFuture\u003cT> future = new CompletableFuture\u003c>();\n    SCHEDULER.schedule(() -> future.complete(value), delayMs, TimeUnit.MILLISECONDS);\n    return future;\n  }\n\n  static GraphQL engine() {\n    Map\u003cString, Object> empty = new HashMap\u003c>();\n    DataFetcher\u003cObject> emptyObject = env -> empty;\n    RuntimeWiring wiring = RuntimeWiring.newRuntimeWiring()\n        .type(\"Query\", t -> t.dataFetcher(\"obj\", emptyObject))\n        .type(\"Obj\", t -> t\n            .dataFetcher(\"fast\", env -> \"obj-fast\")\n            .dataFetcher(\"slow\", env -> after(300, \"obj-slow\"))\n            .dataFetcher(\"inner\", emptyObject))\n        .type(\"Inner\", t -> t.dataFetcher(\"fast\", env -> \"inner-fast\"))\n        .build();\n    GraphQLSchema schema =\n        new SchemaGenerator().makeExecutableSchema(new SchemaParser().parse(SDL), wiring);\n    return GraphQL.newGraphQL(schema).build();\n  }\n\n  /** Runs the query and returns the deferred labels in the order they were delivered. */\n  static List\u003cString> run(GraphQL graphQL, boolean eager) throws InterruptedException {\n    ExecutionInput input = ExecutionInput.newExecutionInput(QUERY)\n        .graphQLContext(builder -> GraphQL.unusualConfiguration(builder)\n            .incrementalSupport()\n            .enableIncrementalSupport(true)\n            .enableEarlyIncrementalFieldExecution(eager))\n        .build();\n    long start = System.nanoTime();\n    IncrementalExecutionResult result = (IncrementalExecutionResult) graphQL.execute(input);\n    System.out.printf(\"  %4d ms  initial  %s%n\", (System.nanoTime() - start) / 1_000_000,\n        result.toSpecification().get(\"data\"));\n\n    List\u003cString> labels = new ArrayList\u003c>();\n    CountDownLatch done = new CountDownLatch(1);\n    result.getIncrementalItemPublisher().subscribe(new Subscriber\u003cDelayedIncrementalPartialResult>() {\n      Subscription subscription;\n\n      @Override public void onSubscribe(Subscription s) {\n        subscription = s;\n        s.request(1);\n      }\n\n      @Override public void onNext(DelayedIncrementalPartialResult part) {\n        long ms = (System.nanoTime() - start) / 1_000_000;\n        for (IncrementalPayload payload : part.getIncremental()) {\n          labels.add(payload.getLabel());\n          System.out.printf(\"  %4d ms  %-7s  path=%s  %s%n\", ms, payload.getLabel(),\n              payload.getPath(), payload.toSpecification().get(\"data\"));\n        }\n        subscription.request(1);\n      }\n\n      @Override public void onError(Throwable t) {\n        t.printStackTrace();\n        done.countDown();\n      }\n\n      @Override public void onComplete() {\n        done.countDown();\n      }\n    });\n    if (!done.await(10, TimeUnit.SECONDS)) {\n      throw new IllegalStateException(\"the stream did not complete\");\n    }\n    return labels;\n  }\n\n  public static void main(String[] args) throws Exception {\n    System.out.println(\"graphql-java from \" + GraphQL.class.getProtectionDomain().getCodeSource().getLocation());\n    GraphQL graphQL = engine();\n    boolean childFirst = false;\n    for (boolean eager : new boolean[] {false, true}) {\n      System.out.println(\"enableEarlyIncrementalFieldExecution=\" + eager);\n      List\u003cString> labels = run(graphQL, eager);\n      boolean ok = labels.indexOf(\"parent\") \u003c labels.indexOf(\"child\");\n      childFirst |= !ok;\n      System.out.println(\"  order \" + labels + (ok ? \"  OK\" : \"  child delivered before its parent\"));\n    }\n    SCHEDULER.shutdown();\n    System.exit(childFirst ? 1 : 0);\n  }\n}\n```\n\n\u003c/details>\n\n### Context\n\n#4497 proposes moving `@defer` to the newer incremental delivery draft. If that replaces the current implementation, it would be good for the new one to keep parents before nested fragments too. We currently work around this with an `Instrumentation` that holds a nested payload until the payloads around it are sent.\n","author":{"url":"https://github.com/superliaye","@type":"Person","name":"superliaye"},"datePublished":"2026-11-21T01:21:23Z","url":"https://github.com/graphql-java/graphql-java/issues/4567"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:42391df4-5070-a2ec-56bb-86b4b5468272
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idAE3E:4279A:1C9F7E4:268137D:6B01764C
html-safe-noncea3556270d76b246bba78679c9e48c60a10dccdd2eb92a65ab3733b10245533eb
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRTNFOjQyNzlBOjFDOUY3RTQ6MjY4MTM3RDo2QjAxNzY0QyIsInZpc2l0b3JfaWQiOiIxOTk0OTc0MjI3MzEyMjQ0MzAwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac6afa6705b8eafe95609c3dac26d24ed1cd99d9e680ea1339decb70b8937b32ba
hovercard-subject-tagissue:6522722181
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/graphql-java/graphql-java/4567/issue_layout
twitter:imagehttps://opengraph.githubassets.com/6b68a7b8339fb95888d8eee9dca5b9c71bbd0894fe9bba27cafb0dcb5d2355e2/graphql-java/graphql-java/issues/4567
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/6b68a7b8339fb95888d8eee9dca5b9c71bbd0894fe9bba27cafb0dcb5d2355e2/graphql-java/graphql-java/issues/4567
og:image:altDescribe the bug With incremental support on, a @defer nested under a field of another @defer is delivered before the fragment that contains it. The child payload's path points at an object that th...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamesuperliaye
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
turbo-cache-controlno-preview
go-importgithub.com/graphql-java/graphql-java git https://github.com/graphql-java/graphql-java.git
octolytics-dimension-user_id14289921
octolytics-dimension-user_logingraphql-java
octolytics-dimension-repository_id38602457
octolytics-dimension-repository_nwographql-java/graphql-java
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id38602457
octolytics-dimension-repository_network_root_nwographql-java/graphql-java
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release8c77c9e8439031ad54c75a250694842892f693e1
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/graphql-java/graphql-java/issues/4567#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgraphql-java%2Fgraphql-java%2Fissues%2F4567
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgraphql-java%2Fgraphql-java%2Fissues%2F4567
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=graphql-java%2Fgraphql-java
Reloadhttps://github.com/graphql-java/graphql-java/issues/4567
Reloadhttps://github.com/graphql-java/graphql-java/issues/4567
Reloadhttps://github.com/graphql-java/graphql-java/issues/4567
graphql-javahttps://github.com/graphql-java
graphql-javahttps://github.com/graphql-java/graphql-java
Codehttps://github.com/graphql-java/graphql-java
Issues27 (27)https://github.com/graphql-java/graphql-java/issues
Pull requests35 (35)https://github.com/graphql-java/graphql-java/pulls
Discussionshttps://github.com/graphql-java/graphql-java/discussions
Actionshttps://github.com/graphql-java/graphql-java/actions
Projectshttps://github.com/graphql-java/graphql-java/projects
Wikihttps://github.com/graphql-java/graphql-java/wiki
Security and qualityhttps://github.com/graphql-java/graphql-java/security
Insightshttps://github.com/graphql-java/graphql-java/insights
https://github.com/graphql-java/graphql-java
New issuehttps://github.com/login?return_to=https://github.com/graphql-java/graphql-java/issues/4567
New issuehttps://github.com/login?return_to=https://github.com/graphql-java/graphql-java/issues/4567
Nested @defer fragment is delivered before the fragment that contains ithttps://github.com/graphql-java/graphql-java/issues/4567#top
https://github.com/superliaye
superliayehttps://github.com/superliaye
on Nov 21, 2026https://github.com/graphql-java/graphql-java/issues/4567#issue-6522722181
graphql/defer-stream-wg#17https://github.com/graphql/defer-stream-wg/discussions/17
#4497https://github.com/graphql-java/graphql-java/issues/4497
Sign up for freehttps://github.com/signup?return_to=https://github.com/graphql-java/graphql-java/issues/4567
Sign in to commenthttps://github.com/login?return_to=https://github.com/graphql-java/graphql-java/issues/4567
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.