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

(fix) - Fix timing for out-of-band client.reexecuteOperation calls #860

Merged
merged 2 commits into from
Jun 12, 2020

Conversation

kitten
Copy link
Member

@kitten kitten commented Jun 12, 2020

Resolve #721

Summary

When an operation becomes asynchronous, by matter of an exchange
delaying it, while it also calls client.reexecuteOpoeration, we
were calling client.reexecuteOperation out-of-band, which causes
the reexecuted operation to be dispatched immediately.
We can't detect the intent of the exchange, and don't know that it
may afterwards immediately send a result synchronously after the delay,
but we do know that once an operation becomes asynchronous, the timing
of client.reexecuteOperation is not sensitive anymore. So instead we
now choose to defer it by a tick.

Set of changes

  • Add a defer to @urql/core
  • Defer flushing the queue actively in reexecuteOperation when no other operation is in-band and actively being worked on

When an operation becomes asynchronous, by matter of an exchange
delaying it, while it also calls client.reexecuteOpoeration, we
were calling client.reexecuteOperation out-of-band, which causes
the reexecuted operation to be dispatched immediately.
We can't detect the intent of the exchange, and don't know that it
may afterwards immediately send a result synchronously after the delay,
but we do know that once an operation becomes asynchronous, the timing
of client.reexecuteOperation is not sensitive anymore. So instead we
now choose to defer it by a tick.
@kitten kitten requested a review from JoviDeCroock June 12, 2020 14:38
@changeset-bot
Copy link

changeset-bot bot commented Jun 12, 2020

🦋 Changeset is good to go

Latest commit: 0697baf

We got this.

This PR includes changesets to release 1 package
Name Type
@urql/core Patch

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 merged commit f468f6d into master Jun 12, 2020
@kitten kitten deleted the fix/dispatch-async-timing branch June 12, 2020 15:04
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.

svelte: client.reexecuteOperation queuing is not effective
2 participants