Skip to content

Commit

Permalink
fix: page and popup state is destroyed on background wakeup
Browse files Browse the repository at this point in the history
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
  • Loading branch information
praschke committed Oct 1, 2023
1 parent 8430fce commit a0c35c5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ext/js/yomichan.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,9 @@ class Yomichan extends EventDispatcher {
}

_onMessageOptionsUpdated({source}) {
this.trigger('optionsUpdated', {source});
if (source !== 'background') {
this.trigger('optionsUpdated', {source});
}
}

_onMessageDatabaseUpdated({type, cause}) {
Expand Down

0 comments on commit a0c35c5

Please sign in to comment.