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

add shouldResubscribe option #389

Merged
merged 2 commits into from Jan 5, 2017

Conversation

Projects
None yet
3 participants
@gilesbradshaw
Copy link
Contributor

gilesbradshaw commented Jan 3, 2017

A should resubscribe option makes subscription queries optionally resubscribe when the props change..

I use it like this:

const NODE_SUBSCRIPTION_QUERY = gql`
  subscription  - blah blah ....

const NODE_QUERY = gql`
  query  - blah blah ....

const _Node = (props) => <Blah />

const options = {
  shouldResubscribe: (props, nextProps) => {
    // if the id property changes then we need to resubscribe..
    return nextProps.id !== props.id
  }
}
const Node = compose(
  graphql(NODE_SUBSCRIPTION_QUERY, options),
  graphql(NODE_QUERY)
)(_Node)
@meteor-bot

This comment has been minimized.

Copy link

meteor-bot commented Jan 3, 2017

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

@jbaxleyiii

This comment has been minimized.

Copy link
Member

jbaxleyiii commented Jan 5, 2017

@gilesbradshaw nice! can you add this to the docs site as well?

@jbaxleyiii jbaxleyiii merged commit 92caa83 into apollographql:master Jan 5, 2017

3 checks passed

CLA Author has signed the Meteor CLA.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage increased (+0.3%) to 94.664%
Details
@gilesbradshaw

This comment has been minimized.

Copy link
Contributor Author

gilesbradshaw commented Jan 5, 2017

sure! apollostack/react-docs#138

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment