fix(browser-extension): off/on performance
This commit is contained in:
parent
005f984dd4
commit
75825eaf14
@ -7,7 +7,7 @@
|
||||
|
||||
/**
|
||||
* @typedef {Object} ExtensionState
|
||||
* @property {ExtensionIssue} issue
|
||||
* @property {ExtensionIssue} [issue]
|
||||
* @property {boolean} on
|
||||
*/
|
||||
|
||||
@ -146,7 +146,7 @@ async function getState(hostname) {
|
||||
state.issue = await refreshIssue(hostname);
|
||||
}
|
||||
|
||||
return state;
|
||||
return { ...stateByDefault, ...state };
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -7,9 +7,8 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} ExtensionState
|
||||
* @typedef {Object} ContentState
|
||||
* @property {boolean} on
|
||||
* @property {ExtensionIssue} [issue]
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -97,7 +96,7 @@ const seen = new Set();
|
||||
|
||||
/**
|
||||
* @description Extension state
|
||||
* @type {ExtensionState}
|
||||
* @type {ContentState}
|
||||
*/
|
||||
let state = { on: true };
|
||||
|
||||
@ -415,7 +414,7 @@ function run(params = {}) {
|
||||
* @param {SetUpParams} [params]
|
||||
*/
|
||||
async function setUp(params = {}) {
|
||||
state = (await dispatch({ hostname, type: 'GET_STATE' })) ?? state;
|
||||
state = await dispatch({ hostname, type: 'GET_STATE' });
|
||||
dispatch({ type: 'ENABLE_POPUP' });
|
||||
|
||||
if (state.on) {
|
||||
|
Loading…
Reference in New Issue
Block a user