Skip to content

Using the same field name on multiple components in a dynamic zone causes conflict #240

@derrickmehaffy

Description

@derrickmehaffy

Bug report

Describe the bug

Note Internal TID164

When using dynamic zones, different components cannot have the same field name with different types (or with enums, different values). GraphQL throws an error like:

image

Steps to reproduce the behavior

  1. Create a model with a dynamic zone
  2. Create two components each with an enum called color (doesn't matter what the values are)
  3. Create a record in the model and set both components and their values
  4. Install GraphQL plugin
  5. Try to query data
  6. See Error (example below)

image

Expected behavior

Error doesn't happen

Screenshots

Entry example:
image

Model structure:
image

Component structure:
image
image

Code snippets

GraphQL Query:

query {
  tests {
    string
    content {
      __typename
      ... on ComponentContentContainer {
        color
      }
      ... on ComponentContentImage {
        color
      }
    }
  }
}

System

  • Node.js version: v12.19.0
  • NPM version: v6.14.8
  • Strapi version: v3.5.4
  • Database: SQLite
  • Operating system: Linux Mint 20.1 (Ubuntu 20.04.1)

Additional context

Sample repo:
testGQLDZ.zip

Metadata

Metadata

Assignees

Labels

issue: quick fixIssues that could be fixed quickly, with small- to medium-sized PRspr: updated contentPRs updating existing documentation contentseverity: lowIf the issue only affects a very niche base of users and an easily implemented workaround can solvesource: Dev DocsPRs/issues targeting the Developer Docstarget: v3Documentation PRs/issues targeting content from docs-v3.strapi.io (v3 branch)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions