scaphold-io / scaphold-issues

Post issues that you find on Scaphold here. Post anything about the platform, docs, boilerplates, etc... Happy Scapholding!
3 stars 0 forks source link

updateUser doesn't change fields of viewer.user #24

Closed brandonmp closed 7 years ago

brandonmp commented 7 years ago

spoke w/ vince abt this in slack, just posting here so details aren't lost in slack chat flow

trying to update the viewer.user & fetch new data from payload.viewer.user

Here's code. Assume viewer.user.id === 'abc' and viewer.user.firstName === 'Brandon'

// mutation to change firstName from "Brandon" to "Bort"

mutation UpdateUser($input: UpdateUserInput!) {
    updateUser(input:$input) {
      changedUser {
        id
        firstName
      }
      viewer {
        user {
          id
          firstName
        }
      }
    }
  }

{
  "input": {
     "id": "abc",
    "firstName": "Bort"
    }
}
// response

{
  "data": {
    "updateUser": {
      "changedUser": {
        "id": "abc",
        "firstName": "Bort"
      },
      "viewer": {
        "user": {
          "id": "abc",
          "firstName": "Brandon"
        }
      }
    }
  }
}

as you can see the response has different values in viewer and changedUser, but the id field is the same, so it's def. 2 diff't values for same record.

vning93 commented 7 years ago

Should be fixed. Messaged you on Slack. Make sure you're not resetting the headers.