-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Refetch promise #178
Refetch promise #178
Conversation
@delianides: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Meteor Contributor Agreement here: https://contribute.meteor.com/ |
@@ -12,6 +12,7 @@ Expect active development and potentially significant breaking changes in the `0 | |||
- Remove all dependencies on the `graphql` parser module at runtime, except for the `gql` template literal tag, so that queries can be pre-parsed in production to save on parsing overhead. | |||
- Add everything that isn't a compiled file to `npmignore`. [PR #165](https://github.com/apollostack/apollo-client/pull/165) | |||
- Move importable modules to root. [PR #169](https://github.com/apollostack/apollo-client/pull/169) | |||
- Queries on refetch return promises. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be in a new section at the top, since it will be in 0.3.2 or later.
Welcome @delianides! |
@stubailo Thanks! Everything should be updated. |
@@ -341,13 +341,17 @@ export class QueryManager { | |||
queryId, | |||
requestId, | |||
}); | |||
|
|||
return result; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't be the correct result if forceFetch
is set to false, because the network response from the server might only contain partial data. This should actually read the data from the store, using something similar to what watchQuery
is doing. Going to look at this in more depth in a bit.
Hey @stubailo I updated this:
|
Taking a look! |
@@ -337,26 +350,43 @@ export class QueryManager { | |||
queryId, | |||
requestId, | |||
}); | |||
|
|||
return result; | |||
}).then((result: GraphQLResult) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This argument isn't used anywhere, is it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stubailo you're right. updated.
@johnthepink looks good, just a few small comments! |
@stubailo updated except for the try/catch comment. Is there a better way to prevent the multiple errors? |
...and rebased to bring in new namespaced actions |
@johnthepink OK, I think we can merge this now, we can handle the edge cases better later! |
Might need to do another rebase, lol. |
@stubailo on it haha |
@stubailo and done |
Published in 0.3.9! |
This is for a change to the QueryManager on refetch to return a Promise instead of void. By returning a promise you eliminate the need to wrap any requests for updating data. So instead of:
You can call
refetch
directly from the Compontent:TODO: