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

Disable refresh button while API call is in progress #154

Merged
merged 3 commits into from
Nov 11, 2018

Conversation

timruffles
Copy link
Contributor

@timruffles timruffles commented Nov 10, 2018

Quick POC of doing this without any significant changes to the code. It'd be good to get comments on some thoughts I had about how the API call is handled in the model and view (below)

refresh disable

The current API code makes this tricky to do particularly well:

  • auto refresh and manual refresh could be simultaneously called
  • the callbacks will be fired whether it's auto or manual

It'd be nice to create a Promise object or similar to return from API calls, which the caller could connect to, e.g:

promise = self.controller.sync_api()
self.refresh.setEnabled(False)
promise.on_settled(lambda: self.refresh.setEnabled(True))

@redshiftzero
Copy link
Contributor

hey @timruffles - yeah the current API calling is a bit tricky right now (a larger refactor is upcoming in #100 to make it easier to work with), but this diff looks great

@redshiftzero redshiftzero merged commit aa91eeb into freedomofpress:master Nov 11, 2018
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.

2 participants