From b8d911bbcc283681e0409e49104e7669bfd13265 Mon Sep 17 00:00:00 2001 From: Jagoda Berry Rybacka Date: Mon, 24 Jul 2023 15:50:50 +0200 Subject: [PATCH] Revert "Debounce dispatched state diffs" This reverts commit bed16a946ee19b71b62bf580c1351e491c76eb17. --- background/main.ts | 24 +++------------------ patches/webext-redux+2.1.7.patch | 37 -------------------------------- 2 files changed, 3 insertions(+), 58 deletions(-) diff --git a/background/main.ts b/background/main.ts index fc60e83b1c..e31b08923f 100644 --- a/background/main.ts +++ b/background/main.ts @@ -508,30 +508,12 @@ export default class Main extends BaseService { // Start up the redux store and set it up for proxying. this.store = initializeStore(savedReduxState, this) - const queueUpdate = debounce( - (lastState, newState, updateFn) => { - if (lastState === newState) { - return - } - - const diff = deepDiff(lastState, newState) - - if (diff !== undefined) { - updateFn(newState, [diff]) - } - }, - 30, - { maxWait: 30, trailing: true } - ) - wrapStore(this.store, { serializer: encodeJSON, deserializer: decodeJSON, - diffStrategy: (oldObj, newObj, forceUpdate) => { - queueUpdate(oldObj, newObj, forceUpdate) - - // Return no diffs as we're manually handling these inside `queueUpdate` - return [] + diffStrategy: (oldObj, newObj) => { + const diffWrapper = deepDiff(oldObj, newObj) + return diffWrapper === undefined ? [] : [diffWrapper] }, dispatchResponder: async ( dispatchResult: Promise, diff --git a/patches/webext-redux+2.1.7.patch b/patches/webext-redux+2.1.7.patch index eb5da3a069..6f1b70506a 100644 --- a/patches/webext-redux+2.1.7.patch +++ b/patches/webext-redux+2.1.7.patch @@ -27,18 +27,6 @@ index 88b6e4f..f16b6dd 100644 @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).WebextRedux={})}(this,(function(e){"use strict";function t(e,t){for(var r=0;t.length>r;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function r(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function n(e){for(var t=1;arguments.length>t;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){r(e,t,n[t])}))}return e}function o(e){return function(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);e.length>t;t++)r[t]=e[t];return r}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var i=9007199254740991,a="[object Arguments]",s="[object Function]",u="[object GeneratorFunction]",c=/^(?:0|[1-9]\d*)$/;function l(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}var f=Object.prototype,d=f.hasOwnProperty,p=f.toString,h=f.propertyIsEnumerable,y=Math.max;function v(e,t){var r=P(e)||function(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&j(e)}(e)&&d.call(e,"callee")&&(!h.call(e,"callee")||p.call(e)==a)}(e)?function(e,t){for(var r=-1,n=Array(e);++r-1&&e%1==0&&t>e}function w(e,t){return e===t||e!=e&&t!=t}var S,E,x,P=Array.isArray;function j(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&i>=e}(e.length)&&!function(e){var t=A(e)?p.call(e):"";return t==s||t==u}(e)}function A(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}var O=(S=function(e,t){!function(e,t,r,n){r||(r={});for(var o=-1,i=t.length;++o1?t[n-1]:void 0,i=n>2?t[2]:void 0;for(o=S.length>3&&"function"==typeof o?(n--,o):void 0,i&&function(e,t,r){if(!A(r))return!1;var n=typeof t;return!!("number"==n?j(r)&&b(t,r.length):"string"==n&&t in r)&&w(r[t],e)}(t[0],t[1],i)&&(o=3>n?void 0:o,n=1),e=Object(e);++r1&&void 0!==arguments[1]?arguments[1]:M;return n({},e,e.payload?{payload:t(e.payload)}:{})},R=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:M,r=arguments.length>2?arguments[2]:void 0;return r?function(n){for(var o=arguments.length,i=Array(o>1?o-1:0),a=1;o>a;a++)i[a-1]=arguments[a];return r.apply(void 0,[n].concat(i))?e.apply(void 0,[N(n,t)].concat(i)):e.apply(void 0,[n].concat(i))}:function(r){for(var n=arguments.length,o=Array(n>1?n-1:0),i=1;n>i;i++)o[i-1]=arguments[i];return e.apply(void 0,[N(r,t)].concat(o))}},I=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:M;return function(t){return function(r,n){return t(R(r,e,n))}}},L=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:M;return function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return function(){for(var n=arguments.length,o=Array(n),i=0;n>i;i++)o[i]=arguments[i];if(r>=o.length)throw Error("Message in request could not be serialized. "+"Expected message in position ".concat(r," but only received ").concat(o.length," args."));return o[r]=N(o[r],e),t.apply(void 0,o)}}},_="updated",C="removed";function H(){var e;try{e=self.chrome||self.browser||browser}catch(t){e=browser}if(!e)throw Error("Browser API is not present");return e}var q={portName:"chromex.port_name",state:{},extensionId:null,serializer:M,deserializer:M,patchStrategy:function(e,t){var r=Object.assign({},e);return t.forEach((function(e){var t=e.key,n=e.value;switch(e.change){case _:r[t]=n;break;case C:Reflect.deleteProperty(r,t)}})),r}};function D(){for(var e=arguments.length,t=Array(e),r=0;e>r;r++)t[r]=arguments[r];return 0===t.length?function(e){return e}:1===t.length?t[0]:t.reduce((function(e,t){return function(){return e(t.apply(void 0,arguments))}}))}var F={portName:"chromex.port_name",dispatchResponder:function(e,t){Promise.resolve(e).then((function(e){t({error:null,value:e})})).catch((function(e){console.error("error dispatching result:",e),t({error:e.message,value:null})}))},serializer:M,deserializer:M,diffStrategy:function(e,t){var r=[];return Object.keys(t).forEach((function(n){e[n]!==t[n]&&r.push({key:n,value:t[n],change:_})})),Object.keys(e).forEach((function(e){t.hasOwnProperty(e)||r.push({key:e,change:C})})),r}};e.Store=function(){function e(){var t=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:q,n=r.portName,o=void 0===n?q.portName:n,i=r.state,a=void 0===i?q.state:i,s=r.extensionId,u=void 0===s?q.extensionId:s,c=r.serializer,l=void 0===c?q.serializer:c,f=r.deserializer,d=void 0===f?q.deserializer:f,p=r.patchStrategy,h=void 0===p?q.patchStrategy:p;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),!o)throw Error("portName is required in options");if("function"!=typeof l)throw Error("serializer must be a function");if("function"!=typeof d)throw Error("deserializer must be a function");if("function"!=typeof h)throw Error("patchStrategy must be one of the included patching strategies or a custom patching function");this.portName=o,this.readyResolved=!1,this.readyPromise=new Promise((function(e){return t.readyResolve=e})),this.browserAPI=H(),this.extensionId=u,this.port=this.browserAPI.runtime.connect(this.extensionId,{name:o}),this.safetyHandler=this.safetyHandler.bind(this),this.browserAPI.runtime.onMessage&&(this.safetyMessage=this.browserAPI.runtime.onMessage.addListener(this.safetyHandler)),this.serializedPortListener=I(d)((function(){var e;return(e=t.port.onMessage).addListener.apply(e,arguments)})),this.serializedMessageSender=L(l)((function(){var e;return(e=t.browserAPI.runtime).sendMessage.apply(e,arguments)}),1),this.listeners=[],this.state=a,this.patchStrategy=h,this.serializedPortListener((function(e){switch(e.type){case k:t.replaceState(e.payload),t.readyResolved||(t.readyResolved=!0,t.readyResolve());break;case z:t.patchState(e.payload)}})),this.dispatch=this.dispatch.bind(this)}var r,n,o;return r=e,(n=[{key:"ready",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return null!==e?this.readyPromise.then(e):this.readyPromise}},{key:"subscribe",value:function(e){var t=this;return this.listeners.push(e),function(){t.listeners=t.listeners.filter((function(t){return t!==e}))}}},{key:"patchState",value:function(e){this.state=this.patchStrategy(this.state,e),this.listeners.forEach((function(e){return e()}))}},{key:"replaceState",value:function(e){this.state=e,this.listeners.forEach((function(e){return e()}))}},{key:"getState",value:function(){return this.state}},{key:"replaceReducer",value:function(){}},{key:"dispatch",value:function(e){var t=this;return new Promise((function(r,n){t.serializedMessageSender(t.extensionId,{type:"chromex.dispatch",portName:t.portName,payload:e},null,(function(e){var t=e.error,o=e.value;if(t){var i=Error("".concat("\nLooks like there is an error in the background page. You might want to inspect your background page for more details.\n").concat(t));n(O(i,t))}else r(o&&o.payload)}))}))}},{key:"safetyHandler",value:function(e){"storeReady"===e.action&&e.portName===this.portName&&(this.browserAPI.runtime.onMessage.removeListener(this.safetyHandler),this.readyResolved||(this.readyResolved=!0,this.readyResolve()))}}])&&t(r.prototype,n),o&&t(r,o),e}(),e.alias=function(e){return function(){return function(t){return function(r){var n=e[r.type];return t(n?n(r):r)}}}},e.applyMiddleware=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;t>n;n++)r[n-1]=arguments[n];var i=function(){throw Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},a={getState:e.getState.bind(e),dispatch:function(){return i.apply(void 0,arguments)}};return r=(r||[]).map((function(e){return e(a)})),i=D.apply(void 0,o(r))(e.dispatch),e.dispatch=i,e},e.wrapStore=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:F,r=t.portName,n=void 0===r?F.portName:r,o=t.dispatchResponder,i=void 0===o?F.dispatchResponder:o,a=t.serializer,s=void 0===a?F.serializer:a,u=t.deserializer,c=void 0===u?F.deserializer:u,l=t.diffStrategy,f=void 0===l?F.diffStrategy:l;if(!n)throw Error("portName is required in options");if("function"!=typeof s)throw Error("serializer must be a function");if("function"!=typeof c)throw Error("deserializer must be a function");if("function"!=typeof f)throw Error("diffStrategy must be one of the included diffing strategies or a custom diff function");var d=H(),p=function(t,r,o){if("chromex.dispatch"===t.type&&t.portName===n){var a=Object.assign({},t.payload,{_sender:r}),s=null;try{s=e.dispatch(a)}catch(e){s=Promise.reject(e.message),console.error(e)}return i(s,o),!0}},h=function(t){if(t.name===n){var r=L(s)((function(){return t.postMessage.apply(t,arguments)})),o=e.getState(),i=e.subscribe((function(){var t=e.getState(),n=f(o,t);n.length&&(o=t,r({type:z,payload:n}))}));t.onDisconnect.addListener(i),r({type:k,payload:o})}},y=I(c),v=function(e){return"chromex.dispatch"===e.type&&e.portName===n};y((function(){var e;return(e=d.runtime.onMessage).addListener.apply(e,arguments)}))(p,v),d.runtime.onMessageExternal?y((function(){var e;return(e=d.runtime.onMessageExternal).addListener.apply(e,arguments)}))(p,v):console.warn("runtime.onMessageExternal is not supported"),d.runtime.onConnect.addListener(h),d.runtime.onConnectExternal?d.runtime.onConnectExternal.addListener(h):console.warn("runtime.onConnectExternal is not supported"),d.tabs.query({},(function(e){var t=!0,r=!1,o=void 0;try{for(var i,a=e[Symbol.iterator]();!(t=(i=a.next()).done);t=!0){d.tabs.sendMessage(i.value.id,{action:"storeReady",portName:n},(function(){chrome}))}}catch(e){r=!0,o=e}finally{try{t||null==a.return||a.return()}finally{if(r)throw o}}}))},Object.defineProperty(e,"__esModule",{value:!0})})); +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).WebextRedux={})}(this,(function(e){"use strict";function t(e,t){for(var r=0;t.length>r;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function r(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function n(e){for(var t=1;arguments.length>t;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){r(e,t,n[t])}))}return e}function o(e){return function(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);e.length>t;t++)r[t]=e[t];return r}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var i=9007199254740991,a="[object Arguments]",s="[object Function]",u="[object GeneratorFunction]",c=/^(?:0|[1-9]\d*)$/;function l(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}var f=Object.prototype,d=f.hasOwnProperty,p=f.toString,h=f.propertyIsEnumerable,y=Math.max;function v(e,t){var r=P(e)||function(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&j(e)}(e)&&d.call(e,"callee")&&(!h.call(e,"callee")||p.call(e)==a)}(e)?function(e,t){for(var r=-1,n=Array(e);++r-1&&e%1==0&&t>e}function w(e,t){return e===t||e!=e&&t!=t}var S,E,x,P=Array.isArray;function j(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&i>=e}(e.length)&&!function(e){var t=A(e)?p.call(e):"";return t==s||t==u}(e)}function A(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}var O=(S=function(e,t){!function(e,t,r,n){r||(r={});for(var o=-1,i=t.length;++o1?t[n-1]:void 0,i=n>2?t[2]:void 0;for(o=S.length>3&&"function"==typeof o?(n--,o):void 0,i&&function(e,t,r){if(!A(r))return!1;var n=typeof t;return!!("number"==n?j(r)&&b(t,r.length):"string"==n&&t in r)&&w(r[t],e)}(t[0],t[1],i)&&(o=3>n?void 0:o,n=1),e=Object(e);++r1&&void 0!==arguments[1]?arguments[1]:M;return n({},e,e.payload?{payload:t(e.payload)}:{})},R=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:M,r=arguments.length>2?arguments[2]:void 0;return r?function(n){for(var o=arguments.length,i=Array(o>1?o-1:0),a=1;o>a;a++)i[a-1]=arguments[a];return r.apply(void 0,[n].concat(i))?e.apply(void 0,[N(n,t)].concat(i)):e.apply(void 0,[n].concat(i))}:function(r){for(var n=arguments.length,o=Array(n>1?n-1:0),i=1;n>i;i++)o[i-1]=arguments[i];return e.apply(void 0,[N(r,t)].concat(o))}},I=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:M;return function(t){return function(r,n){return t(R(r,e,n))}}},L=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:M;return function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return function(){for(var n=arguments.length,o=Array(n),i=0;n>i;i++)o[i]=arguments[i];if(r>=o.length)throw Error("Message in request could not be serialized. "+"Expected message in position ".concat(r," but only received ").concat(o.length," args."));return o[r]=N(o[r],e),t.apply(void 0,o)}}},_="updated",C="removed";function H(){var e;try{e=self.chrome||self.browser||browser}catch(t){e=browser}if(!e)throw Error("Browser API is not present");return e}var q={portName:"chromex.port_name",state:{},extensionId:null,serializer:M,deserializer:M,patchStrategy:function(e,t){var r=Object.assign({},e);return t.forEach((function(e){var t=e.key,n=e.value;switch(e.change){case _:r[t]=n;break;case C:Reflect.deleteProperty(r,t)}})),r}};function D(){for(var e=arguments.length,t=Array(e),r=0;e>r;r++)t[r]=arguments[r];return 0===t.length?function(e){return e}:1===t.length?t[0]:t.reduce((function(e,t){return function(){return e(t.apply(void 0,arguments))}}))}var F={portName:"chromex.port_name",dispatchResponder:function(e,t){Promise.resolve(e).then((function(e){t({error:null,value:e})})).catch((function(e){console.error("error dispatching result:",e),t({error:e.message,value:null})}))},serializer:M,deserializer:M,diffStrategy:function(e,t){var r=[];return Object.keys(t).forEach((function(n){e[n]!==t[n]&&r.push({key:n,value:t[n],change:_})})),Object.keys(e).forEach((function(e){t.hasOwnProperty(e)||r.push({key:e,change:C})})),r}};e.Store=function(){function e(){var t=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:q,n=r.portName,o=void 0===n?q.portName:n,i=r.state,a=void 0===i?q.state:i,s=r.extensionId,u=void 0===s?q.extensionId:s,c=r.serializer,l=void 0===c?q.serializer:c,f=r.deserializer,d=void 0===f?q.deserializer:f,p=r.patchStrategy,h=void 0===p?q.patchStrategy:p;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),!o)throw Error("portName is required in options");if("function"!=typeof l)throw Error("serializer must be a function");if("function"!=typeof d)throw Error("deserializer must be a function");if("function"!=typeof h)throw Error("patchStrategy must be one of the included patching strategies or a custom patching function");this.portName=o,this.readyResolved=!1,this.readyPromise=new Promise((function(e){return t.readyResolve=e})),this.browserAPI=H(),this.extensionId=u,this.port=this.browserAPI.runtime.connect(this.extensionId,{name:o}),this.safetyHandler=this.safetyHandler.bind(this),this.browserAPI.runtime.onMessage&&(this.safetyMessage=this.browserAPI.runtime.onMessage.addListener(this.safetyHandler)),this.serializedPortListener=I(d)((function(){var e;return(e=t.port.onMessage).addListener.apply(e,arguments)})),this.serializedMessageSender=L(l)((function(){var e;return(e=t.browserAPI.runtime).sendMessage.apply(e,arguments)}),1),this.listeners=[],this.state=a,this.patchStrategy=h,this.serializedPortListener((function(e){switch(e.type){case k:t.replaceState(e.payload),t.readyResolved||(t.readyResolved=!0,t.readyResolve());break;case z:t.patchState(e.payload)}})),this.dispatch=this.dispatch.bind(this)}var r,n,o;return r=e,(n=[{key:"ready",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return null!==e?this.readyPromise.then(e):this.readyPromise}},{key:"subscribe",value:function(e){var t=this;return this.listeners.push(e),function(){t.listeners=t.listeners.filter((function(t){return t!==e}))}}},{key:"patchState",value:function(e){this.state=this.patchStrategy(this.state,e),this.listeners.forEach((function(e){return e()}))}},{key:"replaceState",value:function(e){this.state=e,this.listeners.forEach((function(e){return e()}))}},{key:"getState",value:function(){return this.state}},{key:"replaceReducer",value:function(){}},{key:"dispatch",value:function(e){var t=this;return new Promise((function(r,n){t.serializedMessageSender(t.extensionId,{type:"chromex.dispatch",portName:t.portName,payload:e},null,(function(e){var t=e.error,o=e.value;if(t){var i=Error("".concat("\nLooks like there is an error in the background page. You might want to inspect your background page for more details.\n").concat(t));n(O(i,t))}else r(o&&o.payload)}))}))}},{key:"safetyHandler",value:function(e){"storeReady"===e.action&&e.portName===this.portName&&(this.browserAPI.runtime.onMessage.removeListener(this.safetyHandler),this.readyResolved||(this.readyResolved=!0,this.readyResolve()))}}])&&t(r.prototype,n),o&&t(r,o),e}(),e.alias=function(e){return function(){return function(t){return function(r){var n=e[r.type];return t(n?n(r):r)}}}},e.applyMiddleware=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;t>n;n++)r[n-1]=arguments[n];var i=function(){throw Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},a={getState:e.getState.bind(e),dispatch:function(){return i.apply(void 0,arguments)}};return r=(r||[]).map((function(e){return e(a)})),i=D.apply(void 0,o(r))(e.dispatch),e.dispatch=i,e},e.wrapStore=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:F,r=t.portName,n=void 0===r?F.portName:r,o=t.dispatchResponder,i=void 0===o?F.dispatchResponder:o,a=t.serializer,s=void 0===a?F.serializer:a,u=t.deserializer,c=void 0===u?F.deserializer:u,l=t.diffStrategy,f=void 0===l?F.diffStrategy:l;if(!n)throw Error("portName is required in options");if("function"!=typeof s)throw Error("serializer must be a function");if("function"!=typeof c)throw Error("deserializer must be a function");if("function"!=typeof f)throw Error("diffStrategy must be one of the included diffing strategies or a custom diff function");var d=H(),p=function(t,r,o){if("chromex.dispatch"===t.type&&t.portName===n){var a=Object.assign({},t.payload,{_sender:r}),s=null;try{s=e.dispatch(a)}catch(e){s=Promise.reject(e.message),console.error(e)}return i(s,o),!0}},h=function(t){if(t.name===n){var r=L(s)((function(){return t.postMessage.apply(t,arguments)})),o=e.getState(),i=e.subscribe((function(){var t=e.getState(),n=f(o,t);n.length&&(o=t,r({type:z,payload:n}))}));t.onDisconnect.addListener(i),r({type:k,payload:o})}},y=I(c),v=function(e){return"chromex.dispatch"===e.type&&e.portName===n};y((function(){var e;return(e=d.runtime.onMessage).addListener.apply(e,arguments)}))(p,v),d.runtime.onMessageExternal&&false?y((function(){var e;return(e=d.runtime.onMessageExternal).addListener.apply(e,arguments)}))(p,v):console.warn("runtime.onMessageExternal is not supported"),d.runtime.onConnect.addListener(h),d.runtime.onConnectExternal&&false?d.runtime.onConnectExternal.addListener(h):console.warn("runtime.onConnectExternal is not supported"),d.tabs.query({},(function(e){var t=!0,r=!1,o=void 0;try{for(var i,a=e[Symbol.iterator]();!(t=(i=a.next()).done);t=!0){d.tabs.sendMessage(i.value.id,{action:"storeReady",portName:n},(function(){chrome}))}}catch(e){r=!0,o=e}finally{try{t||null==a.return||a.return()}finally{if(r)throw o}}}))},Object.defineProperty(e,"__esModule",{value:!0})})); -diff --git a/node_modules/webext-redux/index.d.ts b/node_modules/webext-redux/index.d.ts -index 3dd5e29..66eeca6 100644 ---- a/node_modules/webext-redux/index.d.ts -+++ b/node_modules/webext-redux/index.d.ts -@@ -1,6 +1,6 @@ - import * as redux from 'redux'; - --export type DiffStrategy = (oldObj: any, newObj: any) => any; -+export type DiffStrategy = (oldObj: any, newObj: any, forceUpdate: (newState: any, diff:any[]) => void) => any; - export type PatchStrategy = (oldObj: any, patch: any) => any; - - export class Store { diff --git a/node_modules/webext-redux/lib/store/Store.js b/node_modules/webext-redux/lib/store/Store.js index 8f49d00..869d62e 100644 --- a/node_modules/webext-redux/lib/store/Store.js @@ -65,28 +53,3 @@ index 8f49d00..869d62e 100644 if (error) { var bgErr = new Error("".concat(backgroundErrPrefix).concat(error)); reject((0, _lodash.default)(bgErr, error)); -diff --git a/node_modules/webext-redux/lib/wrap-store/wrapStore.js b/node_modules/webext-redux/lib/wrap-store/wrapStore.js -index 5dc1dea..23e8c77 100644 ---- a/node_modules/webext-redux/lib/wrap-store/wrapStore.js -+++ b/node_modules/webext-redux/lib/wrap-store/wrapStore.js -@@ -114,11 +114,19 @@ var _default = function _default(store) { - var serializedMessagePoster = (0, _serialization.withSerializer)(serializer)(function () { - return port.postMessage.apply(port, arguments); - }); -+ - var prevState = store.getState(); - -+ var forceUpdate = (newState, diff) =>{ -+ prevState = newState -+ serializedMessagePoster({ -+ type: _constants.PATCH_STATE_TYPE, -+ payload: diff -+ })} -+ - var patchState = function patchState() { - var state = store.getState(); -- var diff = diffStrategy(prevState, state); -+ var diff = diffStrategy(prevState, state, forceUpdate); - - if (diff.length) { - prevState = state;