Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

Multiple types for fields. Conflict when querying.

default discord avatar
rene.k32 years ago
7

I'm using the same field called

Link

in multiple collections. I'm creating the field with the Field type from payload/types. I'm importing that field in the collections where I'm using it. I'm also using the same field in blocks. My problem now is, that payload doesn't generate types for that field and when querying a collection and it's blocks where multiple blocks use that

Link

field, I'm getting a conflict error.



So basically I have multiple types for the same field. Like

Block1_Link

,

Block2_Link

,

Block3_Link

. Instead I should have

Link

as the type, anytime I use the field

Link

.



Any idea how to solve this?

  • discord user avatar
    dribbens
    2 years ago

    What is the error specifically? I can understand how this would be a problem, but I'm not sure the solution and seeing the error would help.

  • default discord avatar
    rene.k32 years ago
    {"message": "Fields \"link\" conflict because subfields \"type\" conflict because they return conflicting types \"Hero1_Link_type\" and \"Hero2_Link_type\" and subfields \"subtype\" conflict because they return conflicting types \"Hero1_Link_subtype\" and \"Hero2_Link_subtype\" and subfields \"coll\" conflict because they return conflicting types \"Hero1_Link_coll\" and \"Hero2_Link_coll\" and subfields \"rel\" conflict because they return conflicting types \"Hero1_Link_rel\" and \"Hero2_Link_rel\" and subfields \"target\" conflict because they return conflicting types \"Hero1_Link_target\" and \"Hero2_Link_target\" and subfields \"referrerpolicy\" conflict because they return conflicting types \"Hero1_Link_referrerpolicy\" and \"Hero2_Link_referrerpolicy\". Use different aliases on the fields to fetch both if this was intentional."}
  • discord user avatar
    jmikrut
    2 years ago

    yes, we are releasing a new way to "flatten" the GraphQL types into a single reusable interface



    @969226489549713438

    we should release that feature ASAP and then comment here

  • discord user avatar
    dribbens
    2 years ago

    Aye, good call!

  • default discord avatar
    rene.k32 years ago

    Nice. Thanks for help guys.

  • discord user avatar
    dribbens
    2 years ago

    OK 1.9.0 has it.



    Thanks for being patient.



    @815884223205605386

    Give it a shot and let us know

  • default discord avatar
    rene.k32 years ago
    @969226489549713438

    It's awesome. It works great. I like the solution. Thanks for the quick turnaround.

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team.