-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@graphql decorator #1
Conversation
# Conflicts: # examples/hello-world/package.json
@kamilkisiela @Urigo |
@dotansimha Few things. I think there's going to be a change how we specify a query and a mutation. Instead of {
name: "myMutation",
document: mutation, // this is a Document
updateQueries: () => {
// handle response
}
} Why do we keep subscriptions as an array of Instead of: {
name: "myQuery",
query: query, // this is a Document
subscriptions: [{
name: "mySubscription",
subscription: subscription // this is the gql Document,
updateQueries: () => {
// update the store
}
}]
} we could just do this: {
name: "mySubscription",
document: subscription, // this is a Document
updateQueries: () => {
// update the store
}
} Super pumped to have a new dev in |
Thanks @kamilkisiela !! Yeah you are correct regarding the |
You've got First one is a part of and yes, it's not documented, don't know why :) |
We could allow user to just use a subscription and then he could decide which queries he wants to update. This way one subscription could update n number of queries. |
@kamilkisiela I see. so we can keep it simpler and provide the same API for creating subscriptions. But how can you update the redux store when a new data arrives into the subscription without creating the subscription from the original query? Thanks! |
TODO
Query
Usage is very similar to
apollo-react
component containers.Usage for query with static options object:
Usage for query with context-based options object (passed as a function):
Mutation
Usage is very similar to
apollo-react
component containers.Mutation exposes a method - which is the execution method, which accepts any Mutation properties that available on (
MutationOptions
formapollo-client
) only without the mutation Document (which passed to the decorator).Example for usage with predefined variables and options, but handle
updateQueries
inside the Component:Example for usage with external logic of
updateQueries
and dynamic variables:Subscription
The main issue is to split the Component logic and the GraphQL subscription query.
Splitting the data and the view, but still provide an API to update the store on data change.
Subscriptions needs to be executed from an existing query, but we still wan't the gql object to be in use outside the Component's code.
This is the current implementation for subscriptions over query, this is not final and feel free to suggest a better usage: