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

(breaking) - Remove pollInterval option from urql #1374

Merged
merged 6 commits into from
Feb 10, 2021

Conversation

kitten
Copy link
Member

@kitten kitten commented Feb 10, 2021

Resolves #531

Summary

This PR removes the pollInterval option from @urql/core and all bindings. Generally it isn't hard to replace pollInterval in user-land with even more correct behaviour, as it can ultimately read the results of the bindings and react to those accordingly.

React / Preact replacement

This just demonstrates that it's rather simple to replace the implementation in React-land.

const [result, executeQuery] = useQuery(...);

useEffect(() => {
  if (!result.fetching) {
    const id = setTimeout(() => executeQuery({ requestPolicy: 'network-only' }), 5000);
    return () => clearTimeout(id);
  }
}, [result.fetching, executeQuery]);

NOTE re #531: It's worth noting that this PR doesn't resolve the issue explicitly, however we see it as much easier to implement effects in user-land that call executeQuery to refresh the results on an interval.

Set of changes

  • Remove pollInterval from @urql/core
  • Remove pollInterval from useQuery in urql
  • Remove pollInterval from useQuery in @urql/preact
  • Remove pollInterval from useQuery in @urql/vue

@changeset-bot
Copy link

changeset-bot bot commented Feb 10, 2021

🦋 Changeset detected

Latest commit: d27c1a4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@urql/core Major
@urql/vue Minor
urql Major
@urql/preact Major
@urql/svelte Patch
next-urql Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@kitten kitten requested a review from JoviDeCroock February 10, 2021 12:50
Copy link
Collaborator

@JoviDeCroock JoviDeCroock left a comment

Choose a reason for hiding this comment

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

A few mentions of pollInterval in the vue tests but generally looks awesome! We should later amend the docs with the replacement.

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.

pollInterval doesn't wait for a response before dispatching next call
2 participants