schickling
04/24/2017, 8:11 PMnickhudkins
04/24/2017, 8:12 PMnickhudkins
04/24/2017, 8:12 PMschickling
04/24/2017, 8:12 PMnickhudkins
04/24/2017, 8:12 PMmewdriller
04/24/2017, 9:13 PMartyom
04/24/2017, 9:22 PMphil
04/24/2017, 9:36 PMnilan
04/24/2017, 9:37 PMnilan
04/24/2017, 9:38 PMmannigan
04/24/2017, 9:52 PMphil
04/24/2017, 9:54 PMphil
04/24/2017, 9:54 PMcount
which just increments for every new item created in the table.phil
04/24/2017, 9:55 PMnilan
04/24/2017, 9:55 PMphil
04/24/2017, 9:55 PMnilan
04/24/2017, 9:56 PMartyom
04/24/2017, 10:32 PMdmiller
04/25/2017, 2:21 AMGraphQL error: Insufficient permissions for this mutation
. The mutation looks like this:
mutation createPick($name: String!, $url: String, $episodeId: ID, $userId: ID){
createPick(name: $name, url: $url, episodeId: $episodeId, userId: $userId) {
name,
url
}
}
I've executed similar mutations using code that looks basically the same no problem. Any thoughts? Happy to provide any other information, this is just a toy app basically.dmiller
04/25/2017, 2:31 AMsdubois
04/25/2017, 4:53 AMartyom
04/25/2017, 9:13 AMnotrab
04/25/2017, 9:31 AMFile
schema, is it possible to upload a file using a remote URL? I’ve about 500 Types I want to important which all have a file associated on AWS currently but it would be good to important to graphcoolnotrab
04/25/2017, 9:34 AMlucfranken
04/25/2017, 11:49 AMartyom
04/25/2017, 12:05 PMknowbody
04/25/2017, 1:07 PMartyom
04/25/2017, 1:20 PMtheom
04/25/2017, 2:12 PMimport ApolloClient, {
createNetworkInterface,
addTypeName,
} from 'apollo-client';
import {
SubscriptionClient,
addGraphQLSubscriptions,
} from 'subscriptions-transport-ws';
import {
Subscription_Add_Delete_Comment_Query,
} from './graphql/mutations-queries';
// Create WebSocket client
const wsClient = new SubscriptionClient('<wss://subscriptions.graph.cool/v1/projectID>', {
reconnect: true,
connectionParams: {
// Pass any arguments you want for initialization
}
})
const networkInterface = createNetworkInterface({
uri: '<https://api.graph.cool/simple/v1/projectID>',
opts: {
// Additional fetch options like `credentials` or `headers`
credentials: 'same-origin',
}
})
// Extend the network interface with the WebSocket
const networkInterfaceWithSubscriptions = addGraphQLSubscriptions(
networkInterface,
wsClient
)
const client = new ApolloClient({
networkInterface: networkInterfaceWithSubscriptions,
dataIdFromObject: (o) => o.id,
addTypeName: true
})
// Create subscription
let createDeleteSubscription = {
query: Subscription_Add_Delete_Comment_Query,
variables: {}
};
export let subscriptionObservable = client.subscribe(createDeleteSubscription);
export default client;
And then I do (App.js)
import { subscriptionObservable } from '../apolloClient';
const Comments = React.createClass({
componentWillMount () {
this.subscription = this.subscribe();
console.log(`Subscribed for new messages with ID: ${this.subscription._networkSubscriptionId}`);
},
subscribe() {
return subscriptionObservable.subscribe({
error: (error) => {
console.log(`Subscription error: ${error}`);
},
next: (data) => {
console.log(`Subscription result: ${data.mutation}`);
}
});
},
render() {
const comments = this.props.post.comments || [];
return (
<div className="comments">
{_.map(comments, this.renderComment)}
<form onSubmit={this.handleSubmit} ref="commentForm" className="comment-form">
<input type="text" ref="author" placeholder="author"/>
<input type="text" ref="comment" placeholder="comment"/>
<input type="submit" hidden/>
</form>
</div>
);
}
});
Comments.propTypes = {
client: React.PropTypes.instanceOf(ApolloClient).isRequired,
}
const CommentsWithApollo = withApollo(Comments);
export default CommentsWithApollo;
My subscription is as follows:
export const Subscription_Add_Delete_Comment_Query = gql`
subscription CreateDeleteComment {
Comments (
filter: {
mutation_in: [CREATED, DELETED]
}
) {
mutation
node {
__typename
id
user
text
posts {
id
}
}
previousValues {
__typename
id
user
text
}
}
}
`;
Now when I add a comment, say in firefox, console shows that the subscription has fired, but the change is only reflected in Chrome when I physically reload the page.
What is the issue here?rockchalkwushock
04/25/2017, 2:32 PMgraphql-relay
. The following: id: globalIdField('User'),
is being used when the nodeDefinitions
is being ran correct?
const { nodeField, nodeInterface } = nodeDefinitions(
(globalId) => {
const { id, type } = fromGlobalId(globalId); // this globalId is stemming from the above...if that's what is provided at that point in time?
}
);