aboutsummaryrefslogtreecommitdiff
path: root/ext/bg
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-11-17 19:40:19 -0500
committerGitHub <noreply@github.com>2020-11-17 19:40:19 -0500
commita48ac37815016c820b2b2a7e79788fed07ae191f (patch)
tree70c6a89d10117725984c0b2b794c91386b8684b4 /ext/bg
parentea7b8621c3620ae55d2596f98c26f33b479db01c (diff)
Use an overridable property to control progress indicator visibility (#1041)
Diffstat (limited to 'ext/bg')
-rw-r--r--ext/bg/js/query-parser.js23
1 files changed, 12 insertions, 11 deletions
diff --git a/ext/bg/js/query-parser.js b/ext/bg/js/query-parser.js
index f56c2ecc..3217316d 100644
--- a/ext/bg/js/query-parser.js
+++ b/ext/bg/js/query-parser.js
@@ -21,10 +21,10 @@
*/
class QueryParser extends EventDispatcher {
- constructor({getOptionsContext, setSpinnerVisible, documentUtil}) {
+ constructor({getOptionsContext, progressIndicatorVisible, documentUtil}) {
super();
this._getOptionsContext = getOptionsContext;
- this._setSpinnerVisible = setSpinnerVisible;
+ this._progressIndicatorVisible = progressIndicatorVisible;
this._selectedParser = null;
this._documentUtil = documentUtil;
this._parseResults = [];
@@ -63,17 +63,18 @@ class QueryParser extends EventDispatcher {
}
async setText(text) {
- this._setSpinnerVisible(true);
+ const overrideToken = this._progressIndicatorVisible.setOverride(true);
+ try {
+ this._setPreview(text);
- this._setPreview(text);
+ this._parseResults = await api.textParse(text, this._getOptionsContext());
+ this._refreshSelectedParser();
- this._parseResults = await api.textParse(text, this._getOptionsContext());
- this._refreshSelectedParser();
-
- this._renderParserSelect();
- this._renderParseResult();
-
- this._setSpinnerVisible(false);
+ this._renderParserSelect();
+ this._renderParseResult();
+ } finally {
+ this._progressIndicatorVisible.clearOverride(overrideToken);
+ }
}
// Private