From 74546f9fafcc2ffdab8b063c08bf9d4ba01ff4cb Mon Sep 17 00:00:00 2001 From: kuuuube Date: Fri, 10 May 2024 22:27:52 -0400 Subject: [PATCH 1/3] Prevent updating dict entry details for anki when anki is disabled --- ext/js/display/display-anki.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ext/js/display/display-anki.js b/ext/js/display/display-anki.js index 6a6ec215f7..0f81fcc268 100644 --- a/ext/js/display/display-anki.js +++ b/ext/js/display/display-anki.js @@ -263,7 +263,9 @@ export class DisplayAnki { /** */ _onContentUpdateComplete() { - void this._updateDictionaryEntryDetails(); + if (this._display.getOptions()?.anki.enable) { + void this._updateDictionaryEntryDetails(); + } } /** From 1b4cfa595237ac4dad7377c00cfcd36a60ac7182 Mon Sep 17 00:00:00 2001 From: kuuuube Date: Fri, 10 May 2024 23:03:31 -0400 Subject: [PATCH 2/3] Move check to _updateDictionaryEntryDetails --- ext/js/display/display-anki.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ext/js/display/display-anki.js b/ext/js/display/display-anki.js index 0f81fcc268..1620e01683 100644 --- a/ext/js/display/display-anki.js +++ b/ext/js/display/display-anki.js @@ -263,9 +263,7 @@ export class DisplayAnki { /** */ _onContentUpdateComplete() { - if (this._display.getOptions()?.anki.enable) { - void this._updateDictionaryEntryDetails(); - } + void this._updateDictionaryEntryDetails(); } /** @@ -353,6 +351,7 @@ export class DisplayAnki { /** */ async _updateDictionaryEntryDetails() { + if (this._display.getOptions()?.anki.enable) { return; } const {dictionaryEntries} = this._display; /** @type {?import('core').TokenObject} */ const token = {}; From df10cc2459f081e24807ad0a1197fb46ca3247a4 Mon Sep 17 00:00:00 2001 From: kuuuube Date: Fri, 10 May 2024 23:13:59 -0400 Subject: [PATCH 3/3] Fix if --- ext/js/display/display-anki.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/js/display/display-anki.js b/ext/js/display/display-anki.js index 1620e01683..442319f78d 100644 --- a/ext/js/display/display-anki.js +++ b/ext/js/display/display-anki.js @@ -351,7 +351,7 @@ export class DisplayAnki { /** */ async _updateDictionaryEntryDetails() { - if (this._display.getOptions()?.anki.enable) { return; } + if (!this._display.getOptions()?.anki.enable) { return; } const {dictionaryEntries} = this._display; /** @type {?import('core').TokenObject} */ const token = {};