nilan
12/04/2016, 9:52 AMhenny
12/04/2016, 9:52 AMnilan
12/04/2016, 9:53 AMgeocine
12/04/2016, 2:03 PMEveryone
to Authenticated
when I click on Update Permissions
looks like nothing is happening. Do I have to do something else?geocine
12/04/2016, 2:05 PMupdateModelPremission
this is what I see
{
"data": {
"updateModelPermission": null
},
"errors": [
{
"message": "Whoops. Looks like an internal server error. Please contact us in Slack (<https://slack.graph.cool>) and send us your Request ID: ciwapysm816aa0187je7lyj7r",
"requestId": "ciwapysm816aa0187je7lyj7r",
"path": [
"updateModelPermission"
],
"locations": [
{
"line": 1,
"column": 74
}
]
}
]
}
nilan
12/04/2016, 2:11 PMgeocine
12/04/2016, 3:07 PM{
"data": {
"updateModelPermission": null
},
"errors": [
{
"message": "Whoops. Looks like an internal server error. Please contact us in Slack (<https://slack.graph.cool>) and send us your Request ID: ciwas7bkv16wa0187ym4xmmip",
"requestId": "ciwas7bkv16wa0187ym4xmmip",
"path": [
"updateModelPermission"
],
"locations": [
{
"line": 1,
"column": 80
}
]
}
]
}
Also it is really intended to return an HTTP 200 for errors?nilan
12/04/2016, 3:08 PMgeocine
12/04/2016, 3:09 PMnilan
12/04/2016, 3:17 PMerrors
object to inform the consumer. if you do a bad-formed query, we return 400 for example, because we cannot execute a bad-formed query.geocine
12/04/2016, 3:23 PMnilan
12/04/2016, 3:23 PMnilan
12/04/2016, 3:24 PMnilan
12/04/2016, 3:25 PMnilan
12/04/2016, 3:25 PMdata
, and return a "Insufficient permissions" error in errors
simple smilenilan
12/04/2016, 3:25 PMgeocine
12/04/2016, 3:26 PMnilan
12/04/2016, 3:26 PMtmoney
12/05/2016, 7:32 AMdataIdFromObject
. Keep getting an error that there is no id on the result object, since I’m trying to check for result.id
emilrmoeller
12/05/2016, 7:42 AM[{id: ‘123’, name: ‘name 1’}, {id: ‘456’, name: ‘name 2’}]
Then the optimistic response needs to be
{id: ‘something random which doesnt matter’, ‘the new name’}
And the mutation result
{id: ‘789’, ‘the new name’}
tmoney
12/05/2016, 7:47 AMtmoney
12/05/2016, 7:48 AMnull
, when I do that it errors outemilrmoeller
12/05/2016, 7:51 AMemilrmoeller
12/05/2016, 7:51 AMtmoney
12/05/2016, 7:54 AMdataIdFromObject
twice, the first time around it has it, second time around the entire result is undefined. Any reason why that should ever be undefined? Cause if so I could just do a null check on it, but all the examples act as if it should never be undefinedtmoney
12/05/2016, 7:55 AMconst InventoryWithData = graphql(ADD_ITEM_MUTATION, {
props({ ownProps, mutate }) {
return {
addItem({ description, image, price, purchaseDate, quantity, size, type, wholesale }) {
return mutate({
variables: { description, image, price, purchaseDate, quantity, size, type, wholesale },
optimisticResponse: {
__typename: 'Mutation',
createItem: {
__typename: 'Item',
id: 'newTempId'
}
},
updateQueries: {
AllItems: (previousResult, { mutationResult }) => {
debugger;
const newItem = mutationResult.data.addItem;
return update(previousResult, {
allItems: {
$unshift: [newItem]
}
});
}
}
});
}
};
}
})(
graphql(ITEM_QUERY)(Inventory)
);
tmoney
12/05/2016, 7:55 AMdataIdFromObject: (result) => {
if (result.id && result.__typename) { // eslint-disable-line no-underscore-dangle
return result.__typename + result.id; // eslint-disable-line no-underscore-dangle
}
return null;
},
tmoney
12/05/2016, 7:59 AMconst ADD_ITEM_MUTATION = gql`
mutation addItem(
$description: String,
$image: String,
$price: BigDecimal!,
$purchaseDate: DateTime!,
$quantity: Int,
$size: ITEM_SIZE!,
$type: ITEM_TYPE!,
$wholesale: BigDecimal!
){
createItem(
description: $description,
image: $image,
price: $price,
purchaseDate: $purchaseDate,
quantity: $quantity,
size: $size,
type: $type,
wholesale: $wholesale
) { id, __typename }
}
`;
tmoney
12/05/2016, 7:59 AMnilan
12/05/2016, 8:04 AM