Skip to content

Added support for debounce and throttle in ApolloQuery component #349

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

Merged
merged 4 commits into from
Aug 30, 2018

Conversation

Liinkiing
Copy link
Contributor

@Liinkiing Liinkiing commented Aug 5, 2018

I found that debounce and throttle were not presend in the ApolloQuery component. I think that they fit perfectly in the component. Maybe it was by design, if so, could it be integrated in the component?

I'm new into submitting PR in this project, so I don't know if they are some steps required, but I hope it would be useful ! And I could not find development procedures, so I hope that I have not forgotten something !

This PR will allow us to use debounce and throttle like this

<input type="text" v-model="name">
<ApolloQuery :debounce="600" :query="require('...')" :variables="{ name }">
      <template slot-scope="{ result: { data, loading, error } }">
         ...
      </template>
</ApolloQuery>

where name is a v-model, so when it is changed in the input, it will not refetch the query when the input has changed, but it will be debounced! Throttle would work the same way, just add it as a props!

@Psyker
Copy link

Psyker commented Aug 6, 2018

It could be very useful !

@Akryum Akryum merged commit 9ca73d5 into vuejs:master Aug 30, 2018
@nathanwaters
Copy link

Does debounce and throttle work inside this.$apollo.mutate()? Doesn't seem to for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants