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

cancel old graphql requests when new ones are run #8238

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

michaelchadwick
Copy link
Contributor

Reports are run one of two ways via the UI:

  1. Going to /reports, choosing items from the dropdown inputs, and hitting the "Run Report" button
  2. Going to an existing report at /reports/subjects/:id

Either way, it does a GraphQL lookup and the page waits for it to return a value. If you use method 1, and click the button before an existing request is done, it queues it, which can lead to potential long network requests running in the background, especially if you run a long report a bunch of times for either impatience or debugging reasons.

The ideal way to fix this is to improve the searches themselves so that they don't take so long. In the meantime, making sure new requests invalidate old requests is helpful.

This can be done by changing the method from an async func() call to an ember-concurrency-style func = task(async() {}) call, which fixes the issue in case 1 (case 2 doesn't need a fix because you can't re-run the report from ReportsSubjectRoute).

However, there are still two cases that aren't yet covered:

  1. Going to /reports, choosing items from the dropdown inputs, hitting the "Run Report" button, and then hitting the "Cancel" button.
  2. Going to an existing report at /reports/subjects/:id...and then clicking the "Back to Reports" link (or simply clicking back in the browser or somewhere else in the app).

I think I can figure both of these out, but need more time ;P

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.

1 participant