Skip to content

edges returned from transactions do not represent current state #121

@keski

Description

@keski

When executing a transaction the current implementation queries for returned edges after the entire transaction has finished. This means that any intermediate edges queried will represent only the final state.

For example, assume the DB schema below:

type Blog {
    text: String!
    author: Blogger!
}

type Blogger {
    name: String!
}

We create a Blog post using:

mutation {
  createBlog(data: { text: "This is a blog post", author: { create: { name: "John Doe" } } }){
    id
    author {
      id
      name
    }
  }
}

which returns:

{
  createBlog: {
    id: "Blog/123",
    author: {
      id: "Blogger/123",
      name: "John Doe"
    }
  }
}

Let's say we now update the Blog and Blogger in the same mutation request:

mutation {
  updateBlog(id:"Blog/123", data: { text: "This blog has been updated!" }){
    text
    author: {
      name
    }
  }
  m1: updateBlogger(id:"Blogger/123", data: { name: "Alice" }){
    name
  }
  m2: updateBlogger(id:"Blogger/123", data: { name: "Bob" }){
    name
  }
  m3: updateBlogger(id:"Blogger/123", data: { name: "Charlie" }){
    name
  }
}

This will return:

{
  updateBlog: {
    text: "This blog has been updated!",
    author: {
      name: "Charlie" // should still be "John Doe"!
    }
  }
  m1: { name: "Alice" },
  m2: { name: "Bob" },
  m3:  { name: "Charlie" }
}

Metadata

Metadata

Assignees

Labels

backlogKeep open for later (typically, not a problem for SPIRIT but maybe for other woo.sh projects)invalidThis doesn't seem right

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions