Prisma1: Incorrect parent/child self-relation behavior

Created on 12 Mar 2018  路  3Comments  路  Source: prisma/prisma1

Bug Report

Let's consider a type that contains two relations that allows for one to be related to the other and the otherwise around is true as well.

type Item {
  name: String! @unique
  parent: Item @relation(name: "ItemOnItem")
  children: [Item!]! @relation(name: "ItemOnItem")
}

I am creating those two Item with those mutations:

mutation {
  createItem( data: { name: "parent" } )
} {
  name
  parent { name }
  children { name }
}
mutation {
  createItem(
    data: {
       name: "child"
       parent: { connect: { name: "parent" } }
    }
  )
} {
  name
  parent { name }
  children { name }
}

Current behavior

{
  "data": {
    "items": [
      {
        "name": "parent",
        "parent": null,
        "children": []
      },
      {
        "name": "child",
        "parent": {
          "name": "parent"
        },
        "children": [
          {
            "name": "parent"
          }
        ]
      },
    ]
  }
}

Expected behavior?

{
  "data": {
    "items": [
      {
        "name": "parent",
        "parent": null,
        "children": [
          {
            "name": "child"
          }
        ]
      },
      {
        "name": "child",
        "parent": {
          "name": "parent"
        },
        "children": []
      },
    ]
  }
}

Anyone else can confirm this issue?

Most helpful comment

Thanks for reporting this and the detailed description @canercandan

The issue is now fixed on the unstable channel und should be released to the stable channel later today.

bildschirmfoto 2018-03-13 um 13 45 34

All 3 comments

Thanks for reporting this and the detailed description @canercandan

The issue is now fixed on the unstable channel und should be released to the stable channel later today.

bildschirmfoto 2018-03-13 um 13 45 34

@do4gr amazing :raised_hands: thanks

This is now available in 1.4.0 馃檪

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tbrannam picture tbrannam  路  3Comments

schickling picture schickling  路  3Comments

marktani picture marktani  路  3Comments

schickling picture schickling  路  3Comments

notrab picture notrab  路  3Comments