New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More →

mobx-react-lite

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mobx-react-lite - npm Package Compare versions

Comparing version

to
1.1.1

@@ -195,2 +195,3 @@ (function (global, factory) {

};
wrappedComponent.displayName = baseComponentName;
// memo; we are not intested in deep updates

@@ -197,0 +198,0 @@ // in props; we assume that if deep objects are changed,

@@ -21,4 +21,4 @@ import { spy, observable, computed, getDependencyTree, Reaction } from 'mobx';

if (inputs === void 0) { inputs = []; }
var computed$$1 = useMemo(function () { return computed(func); }, inputs);
return computed$$1.get();
var computed$1 = useMemo(function () { return computed(func); }, inputs);
return computed$1.get();
}

@@ -193,2 +193,3 @@

};
wrappedComponent.displayName = baseComponentName;
// memo; we are not intested in deep updates

@@ -195,0 +196,0 @@ // in props; we assume that if deep objects are changed,

@@ -195,2 +195,3 @@ (function (global, factory) {

};
wrappedComponent.displayName = baseComponentName;
// memo; we are not intested in deep updates

@@ -197,0 +198,0 @@ // in props; we assume that if deep objects are changed,

@@ -1,1 +0,1 @@

!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("mobx"),require("react")):"function"==typeof define&&define.amd?define(["exports","mobx","react"],r):r((e=e||self).mobxReact={},e.mobx,e.React)}(this,function(e,r,n){"use strict";if(!n.useState)throw new Error("mobx-react-lite requires React with Hooks support");if(!r.spy)throw new Error("mobx-react-lite requires mobx at least version 4 to be available");var t=function(){};var o=!1;function u(){return o}var i=function(){return(i=Object.assign||function(e){for(var r,n=1,t=arguments.length;n<t;n++)for(var o in r=arguments[n])Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);return e}).apply(this,arguments)};function c(e){return e.current?r.getDependencyTree(e.current):"<unknown>"}var f=[];function a(){var e=function(e,r){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var t,o,u=n.call(e),i=[];try{for(;(void 0===r||r-- >0)&&!(t=u.next()).done;)i.push(t.value)}catch(e){o={error:e}}finally{try{t&&!t.done&&(n=u.return)&&n.call(u)}finally{if(o)throw o.error}}return i}(n.useState(0),2)[1];return n.useCallback(function(){e(function(e){return e+1})},[])}function s(e,t){if(void 0===t&&(t="observed"),u())return e();var o,i,s=a(),l=n.useRef(null);if(l.current||(l.current=new r.Reaction("observer("+t+")",function(){s()})),n.useDebugValue(l,c),function(e){n.useEffect(function(){return e},f)}(function(){l.current.dispose()}),l.current.track(function(){try{o=e()}catch(e){i=e}}),i)throw l.current.dispose(),i;return o}var l={$$typeof:!0,render:!0,compare:!0,type:!0};function p(e){var r=e.children,n=e.render,t=r||n;return"function"!=typeof t?null:s(t)}function d(e,r,n,t,o){var u="children"===r?"render":"children",i="function"==typeof e[r],c="function"==typeof e[u];return i&&c?new Error("MobX Observer: Do not use children and render in the same time in`"+n):i||c?null:new Error("Invalid prop `"+o+"` of type `"+typeof e[r]+"` supplied to `"+n+"`, expected `function`.")}p.propTypes={children:d,render:d},p.displayName="Observer",e.useObservable=function(e){var t=n.useRef(null);return t.current||(t.current=r.observable(e)),t.current},e.useComputed=function(e,t){return void 0===t&&(t=[]),n.useMemo(function(){return r.computed(e)},t).get()},e.useDisposable=function(e,r){void 0===r&&(r=[]);var o=n.useRef(null),u=n.useRef(!1);function i(r){if(u.current)return t;if(!o.current){var n=e();if("function"!=typeof n){var i=new Error("generated disposer must be a function");return console.error(i),t}o.current=n}return function(){o.current&&(o.current(),o.current=null),r&&(u.current=!0)}}return n.useEffect(function(){return i(!1)},r),i(!0)},e.isUsingStaticRendering=u,e.useStaticRendering=function(e){o=e},e.observer=function(e,r){if(u())return e;var t,o,c,f=i({forwardRef:!1},r),a=e.displayName||e.name,p=function(r,n){return s(function(){return e(r,n)},a)};return t=f.forwardRef?n.memo(n.forwardRef(p)):n.memo(p),o=e,c=t,Object.keys(o).forEach(function(e){o.hasOwnProperty(e)&&!l[e]&&Object.defineProperty(c,e,Object.getOwnPropertyDescriptor(o,e))}),t.displayName=a,t},e.useObserver=s,e.Observer=p,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("mobx"),require("react")):"function"==typeof define&&define.amd?define(["exports","mobx","react"],r):r((e=e||self).mobxReact={},e.mobx,e.React)}(this,function(e,r,n){"use strict";if(!n.useState)throw new Error("mobx-react-lite requires React with Hooks support");if(!r.spy)throw new Error("mobx-react-lite requires mobx at least version 4 to be available");var t=function(){};var o=!1;function u(){return o}var i=function(){return(i=Object.assign||function(e){for(var r,n=1,t=arguments.length;n<t;n++)for(var o in r=arguments[n])Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);return e}).apply(this,arguments)};function c(e){return e.current?r.getDependencyTree(e.current):"<unknown>"}var f=[];function a(){var e=function(e,r){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var t,o,u=n.call(e),i=[];try{for(;(void 0===r||r-- >0)&&!(t=u.next()).done;)i.push(t.value)}catch(e){o={error:e}}finally{try{t&&!t.done&&(n=u.return)&&n.call(u)}finally{if(o)throw o.error}}return i}(n.useState(0),2)[1];return n.useCallback(function(){e(function(e){return e+1})},[])}function s(e,t){if(void 0===t&&(t="observed"),u())return e();var o,i,s=a(),l=n.useRef(null);if(l.current||(l.current=new r.Reaction("observer("+t+")",function(){s()})),n.useDebugValue(l,c),function(e){n.useEffect(function(){return e},f)}(function(){l.current.dispose()}),l.current.track(function(){try{o=e()}catch(e){i=e}}),i)throw l.current.dispose(),i;return o}var l={$$typeof:!0,render:!0,compare:!0,type:!0};function p(e){var r=e.children,n=e.render,t=r||n;return"function"!=typeof t?null:s(t)}function d(e,r,n,t,o){var u="children"===r?"render":"children",i="function"==typeof e[r],c="function"==typeof e[u];return i&&c?new Error("MobX Observer: Do not use children and render in the same time in`"+n):i||c?null:new Error("Invalid prop `"+o+"` of type `"+typeof e[r]+"` supplied to `"+n+"`, expected `function`.")}p.propTypes={children:d,render:d},p.displayName="Observer",e.useObservable=function(e){var t=n.useRef(null);return t.current||(t.current=r.observable(e)),t.current},e.useComputed=function(e,t){return void 0===t&&(t=[]),n.useMemo(function(){return r.computed(e)},t).get()},e.useDisposable=function(e,r){void 0===r&&(r=[]);var o=n.useRef(null),u=n.useRef(!1);function i(r){if(u.current)return t;if(!o.current){var n=e();if("function"!=typeof n){var i=new Error("generated disposer must be a function");return console.error(i),t}o.current=n}return function(){o.current&&(o.current(),o.current=null),r&&(u.current=!0)}}return n.useEffect(function(){return i(!1)},r),i(!0)},e.isUsingStaticRendering=u,e.useStaticRendering=function(e){o=e},e.observer=function(e,r){if(u())return e;var t,o,c,f=i({forwardRef:!1},r),a=e.displayName||e.name,p=function(r,n){return s(function(){return e(r,n)},a)};return p.displayName=a,t=f.forwardRef?n.memo(n.forwardRef(p)):n.memo(p),o=e,c=t,Object.keys(o).forEach(function(e){o.hasOwnProperty(e)&&!l[e]&&Object.defineProperty(c,e,Object.getOwnPropertyDescriptor(o,e))}),t.displayName=a,t},e.useObserver=s,e.Observer=p,Object.defineProperty(e,"__esModule",{value:!0})});

@@ -21,4 +21,4 @@ import { spy, observable, computed, getDependencyTree, Reaction } from 'mobx';

if (inputs === void 0) { inputs = []; }
var computed$$1 = useMemo(function () { return computed(func); }, inputs);
return computed$$1.get();
var computed$1 = useMemo(function () { return computed(func); }, inputs);
return computed$1.get();
}

@@ -193,2 +193,3 @@

};
wrappedComponent.displayName = baseComponentName;
// memo; we are not intested in deep updates

@@ -195,0 +196,0 @@ // in props; we assume that if deep objects are changed,

@@ -196,2 +196,3 @@ 'use strict';

};
wrappedComponent.displayName = baseComponentName;
// memo; we are not intested in deep updates

@@ -198,0 +199,0 @@ // in props; we assume that if deep objects are changed,

{
"name": "mobx-react-lite",
"version": "1.1.0",
"version": "1.1.1",
"description": "Lightweight React bindings for MobX based on React 16.8 and Hooks",

@@ -36,4 +36,4 @@ "main": "dist/index.js",

"devDependencies": {
"@types/jest": "23.3.12",
"@types/node": "^10.12.21",
"@types/jest": "^24.0.0",
"@types/node": "^11.0.0",
"@types/react": "^16.8.2",

@@ -43,5 +43,5 @@ "@types/react-dom": "^16.8.0",

"husky": "^1.1.3",
"jest": "^23.6.0",
"jest": "^24.0.0",
"jest-dom": "^3.0.0",
"jest-environment-jsdom": "^23.4.0",
"jest-environment-jsdom": "^24.0.0",
"jest-mock-console": "^0.4.2",

@@ -54,3 +54,3 @@ "lint-staged": "^8.1.3",

"react-dom": "^16.8.0",
"react-testing-library": "^5.5.3",
"react-testing-library": "^6.0.0",
"rimraf": "^2.6.2",

@@ -65,3 +65,3 @@ "rollup": "^1.1.2",

"rollup-plugin-typescript2": "^0.19.2",
"ts-jest": "^23.10.4",
"ts-jest": "^24.0.0",
"tslint": "^5.11.0",

@@ -68,0 +68,0 @@ "tslint-config-prettier": "^1.18.0",

Sorry, the diff of this file is not supported yet