Skip to content

fix(app-headless-cms-common): exclude live field from singleton entry queries#5013

Closed
brick-pixel wants to merge 1 commit intowebiny:nextfrom
brick-pixel:fix/singleton-live-field-query
Closed

fix(app-headless-cms-common): exclude live field from singleton entry queries#5013
brick-pixel wants to merge 1 commit intowebiny:nextfrom
brick-pixel:fix/singleton-live-field-query

Conversation

@brick-pixel
Copy link
Copy Markdown

@brick-pixel brick-pixel commented Mar 16, 2026

What

Moved live { version } from the unconditional system fields into the !isSingletonModel conditional block in createEntrySystemFields.

Why

Singleton models use createSingularSDL to generate their GraphQL schema, which does not include the live field. However, the client-side query builder unconditionally included live { version } for all models, causing:

Uncaught (in promise) Error: GraphQL error: Cannot query field "live" on type "AdminSettings".

The wbyAco_location and meta fields were already correctly excluded for singleton models, but live was placed outside that conditional block.

Changes

File: packages/app-headless-cms-common/src/entries.graphql.ts

  • Moved live { version } inside the existing if (!isSingletonModel) block
  • Removed the standalone live { version } from the unconditional return template

Before

if (!isSingletonModel) {
    optionalFields = \`
        wbyAco_location { folderId }
        meta { ... }
    \`;                          // live was NOT here
}

return \`
    ...
    ${optionalFields}
    live { version }              // ❌ queried for ALL models
\`;

After

if (!isSingletonModel) {
    optionalFields = \`
        wbyAco_location { folderId }
        meta { ... }
        live { version }          // ✅ only for non-singleton
    \`;
}

return \`
    ...
    ${optionalFields}            // ✅ singleton models skip live
\`;

How verified

  • Confirmed createSingularSDL.ts does not include live in the singleton type definition
  • Confirmed wbyAco_location and meta already follow the same exclusion pattern
  • Non-singleton models are unaffected since optionalFields includes live for them

Fixes #5012

… queries

Singleton models use createSingularSDL which does not include the
'live' field in the GraphQL type definition. However, the client-side
createEntrySystemFields unconditionally included 'live { version }'
in all queries, causing:

  Cannot query field "live" on type "<ModelName>"

Moved 'live { version }' inside the existing !isSingletonModel
conditional block, alongside wbyAco_location and meta fields.

Fixes webiny#5012
@github-actions
Copy link
Copy Markdown

Vitest tests have been initiated (for more information, click here). ✨

@github-actions
Copy link
Copy Markdown

Cypress E2E tests have been initiated (for more information, click here). ✨

@github-actions
Copy link
Copy Markdown

Jest tests have been initiated (for more information, click here). ✨

@github-actions
Copy link
Copy Markdown

Cypress E2E tests have been initiated (for more information, click here). ✨

@github-actions
Copy link
Copy Markdown

Jest tests have been initiated (for more information, click here). ✨

@github-actions
Copy link
Copy Markdown

Cypress E2E tests have been initiated (for more information, click here). ✨

@github-actions
Copy link
Copy Markdown

Cypress E2E tests have been initiated (for more information, click here). ✨

@github-actions
Copy link
Copy Markdown

Vitest tests have been initiated (for more information, click here). ✨

@brunozoric
Copy link
Copy Markdown
Contributor

hi @brick-pixel

Issue was fixed, is in our next branch and is ready to be shipped with 6.1. Sorry for the inconvenience!

@github-actions
Copy link
Copy Markdown

Jest tests have been initiated (for more information, click here). ✨

@github-actions
Copy link
Copy Markdown

Cypress E2E tests have been initiated (for more information, click here). ✨

@github-actions
Copy link
Copy Markdown

Cypress E2E tests have been initiated (for more information, click here). ✨

@github-actions
Copy link
Copy Markdown

Vitest tests have been initiated (for more information, click here). ✨

@brick-pixel
Copy link
Copy Markdown
Author

Thanks for the heads up @brunozoric! Closing this since it's already fixed on your end.

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.

Singleton model Admin UI crashes with "Cannot query field live"

2 participants