Skip to content
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

updateQuery of subscribeToMore should be optional #879

Closed
wants to merge 8 commits into from
Closed

updateQuery of subscribeToMore should be optional #879

wants to merge 8 commits into from

Conversation

Torsten85
Copy link
Contributor

As mentioned in #871, the updateQuery function can no be covered with the new graphql options.reducer. So it should be optional.

@apollo-cla
Copy link

@Torsten85: 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/

@@ -228,7 +228,7 @@ export class ObservableQuery extends Observable<ApolloQueryResult> {
variables: options.variables,
});

const reducer = options.updateQuery;
const reducer = options.updateQuery || ((previousResult) => previousResult);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think instead of this we should just not call this.updateQuery on line 243 if options.updateQuery is not passed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't the complete next function be obsolete if updateQuery is not passed? Seems like next is optional.

https://github.com/apollostack/apollo-client/blob/master/src/util/Observable.ts#L38

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you're right! But we still need to call subscribe because otherwise the subscription is not started.

@Torsten85
Copy link
Contributor Author

@stubailo could you have another look.

@helfer
Copy link
Contributor

helfer commented Nov 14, 2016

@Torsten85 I can review it, but can you merge in the changes from master first? We added a couple of lines of code there.

@Torsten85
Copy link
Contributor Author

This pull request should now be up to date with the current master branch.

@helfer
Copy link
Contributor

helfer commented Nov 28, 2016

@Torsten85 I think it's missing a test that shows that updateQueries really is optional, and that everything works as intended when updateQueries isn't provided. Other than that, it looks fine 🙂

@helfer
Copy link
Contributor

helfer commented Dec 5, 2016

@Torsten85 are you still interested in this PR? 🙂

@helfer
Copy link
Contributor

helfer commented Dec 16, 2016

I'm trying to put some order into issues and PRs, so I'm going to close this one for lack of activity, but that doesn't mean that I'm not interested in seeing the feature implemented eventually.

@helfer helfer closed this Dec 16, 2016
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants