fix(app-headless-cms-common): exclude live field from singleton entry queries#5013
fix(app-headless-cms-common): exclude live field from singleton entry queries#5013brick-pixel wants to merge 1 commit intowebiny:nextfrom
Conversation
… 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
|
Vitest tests have been initiated (for more information, click here). ✨ |
|
Cypress E2E tests have been initiated (for more information, click here). ✨ |
|
Jest tests have been initiated (for more information, click here). ✨ |
|
Cypress E2E tests have been initiated (for more information, click here). ✨ |
|
Jest tests have been initiated (for more information, click here). ✨ |
|
Cypress E2E tests have been initiated (for more information, click here). ✨ |
|
Cypress E2E tests have been initiated (for more information, click here). ✨ |
|
Vitest tests have been initiated (for more information, click here). ✨ |
|
hi @brick-pixel Issue was fixed, is in our next branch and is ready to be shipped with 6.1. Sorry for the inconvenience! |
|
Jest tests have been initiated (for more information, click here). ✨ |
|
Cypress E2E tests have been initiated (for more information, click here). ✨ |
|
Cypress E2E tests have been initiated (for more information, click here). ✨ |
|
Vitest tests have been initiated (for more information, click here). ✨ |
|
Thanks for the heads up @brunozoric! Closing this since it's already fixed on your end. |
What
Moved
live { version }from the unconditional system fields into the!isSingletonModelconditional block increateEntrySystemFields.Why
Singleton models use
createSingularSDLto generate their GraphQL schema, which does not include thelivefield. However, the client-side query builder unconditionally includedlive { version }for all models, causing:The
wbyAco_locationandmetafields were already correctly excluded for singleton models, butlivewas placed outside that conditional block.Changes
File:
packages/app-headless-cms-common/src/entries.graphql.tslive { version }inside the existingif (!isSingletonModel)blocklive { version }from the unconditional return templateBefore
After
How verified
createSingularSDL.tsdoes not includelivein the singleton type definitionwbyAco_locationandmetaalready follow the same exclusion patternoptionalFieldsincludeslivefor themFixes #5012