summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsiikamiika <siikamiika@users.noreply.github.com>2019-11-13 15:29:53 +0200
committersiikamiika <siikamiika@users.noreply.github.com>2019-11-23 17:50:46 +0200
commitf6253216505737d588ccff1f07cb5ce0332297a5 (patch)
treed701753e7a105829f56802d683637a4c02776f1e
parent933fd77957cac4027c389b43cddaeb3ea65d9faa (diff)
refactor selected parser refreshing
-rw-r--r--ext/bg/js/search-query-parser.js24
1 files changed, 14 insertions, 10 deletions
diff --git a/ext/bg/js/search-query-parser.js b/ext/bg/js/search-query-parser.js
index c0cad773..42e53989 100644
--- a/ext/bg/js/search-query-parser.js
+++ b/ext/bg/js/search-query-parser.js
@@ -93,16 +93,7 @@ class QueryParser {
this.renderParseResult(this.getParseResult());
}
- getParseResult() {
- return this.parseResults.find(r => r.id === this.selectedParser);
- }
-
- async setText(text) {
- this.search.setSpinnerVisible(true);
-
- await this.setPreview(text);
-
- this.parseResults = await this.parseText(text);
+ refreshSelectedParser() {
if (this.parseResults.length > 0) {
if (this.selectedParser === null) {
this.selectedParser = this.search.options.parsing.selectedParser;
@@ -113,6 +104,19 @@ class QueryParser {
apiOptionsSet({parsing: {selectedParser}}, this.search.getOptionsContext());
}
}
+ }
+
+ getParseResult() {
+ return this.parseResults.find(r => r.id === this.selectedParser);
+ }
+
+ async setText(text) {
+ this.search.setSpinnerVisible(true);
+
+ await this.setPreview(text);
+
+ this.parseResults = await this.parseText(text);
+ this.refreshSelectedParser();
this.renderParserSelect();
await this.renderParseResult();