aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpraschke <stel@comfy.monster>2023-09-01 15:57:09 +0100
committerpraschke <stel@comfy.monster>2023-10-01 10:25:42 +0100
commita0c35c50cdea45c9b3eb49795fe1b0268d48e8f7 (patch)
treee104f873d45cace033d4d8c795bb6db0b49050d9
parent8430fce21912ad08ddeaa3714c6feb0c2cc01c10 (diff)
fix: page and popup state is destroyed on background wakeup
when the background script starts, it sends a `Yomichan.optionsUpdated` message which is retransmitted indiscriminately. - popups are all torn down/refreshed - the search bar on the search page can lose state - if a popup has been loaded on the search page, the search page can redirect/refresh - options being edited can lose state and the options page can refresh
-rw-r--r--ext/js/yomichan.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/ext/js/yomichan.js b/ext/js/yomichan.js
index 5a55b3ea..a4feaa23 100644
--- a/ext/js/yomichan.js
+++ b/ext/js/yomichan.js
@@ -214,7 +214,9 @@ class Yomichan extends EventDispatcher {
}
_onMessageOptionsUpdated({source}) {
- this.trigger('optionsUpdated', {source});
+ if (source !== 'background') {
+ this.trigger('optionsUpdated', {source});
+ }
}
_onMessageDatabaseUpdated({type, cause}) {