Skip to content

fix(v5): support dynamic zone populate fragments - #557

Open
BayBreezy wants to merge 1 commit into
nuxt-modules:mainfrom
BayBreezy:fix/505-dynamic-zone-populate
Open

BayBreezy wants to merge 1 commit into
nuxt-modules:mainfrom
BayBreezy:fix/505-dynamic-zone-populate

Conversation

@BayBreezy

Copy link
Copy Markdown
Contributor

Types of changes

  • Bug fix (a non-breaking change which fixes an issue)
  • New feature (a non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Description

Strapi 5 dynamic-zone queries using populate: { sections: { on: { 'sections.hero': { populate: ['image'] } } } } currently fail typechecking because the populate types do not accept on fragments.

Add fragment support for dynamic-zone arrays, deriving component names from the __component discriminator and checking each fragment against its matching component type. Existing populate forms remain valid, and runtime request handling is unchanged.

Fixes #505.

Compile-time regression tests cover the reported hero/gallery query, partial component selection, nested population, fragment query options, and existing populate syntaxes. Negative cases reject unknown component names, fields from the wrong component, and fragments on ordinary relations. These tests run through the existing CI typecheck step. The reported query was confirmed to fail before the type change.

Validation

  • pnpm install --frozen-lockfile
  • pnpm run dev:prepare
  • pnpm run lint
  • pnpm run typecheck
  • pnpm run test — 43 tests passed, including the Nuxt end-to-end test.
  • pnpm run build
  • Strict TypeScript consumer check of the regression fixture against the generated declarations.

Checklist

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes (if not applicable, please state why)

Documentation changes are not required: this corrects the types for existing Strapi query syntax.

@pkg-pr-new

pkg-pr-new Bot commented Oct 16, 2026

Copy link
Copy Markdown
npm i https://pkg.pr.new/@nuxtjs/strapi@557

commit: c6d6f83

This branch has not been deployed

No deployments
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.

Populate Dynamic Zones type error

1 participant