organism-react-popup
Advanced tools
Comparing version 0.15.14 to 0.15.15
@@ -20,8 +20,4 @@ "use strict"; | ||
var _reshowFluxBase = require("reshow-flux-base"); | ||
var _reshowFlux = require("reshow-flux"); | ||
var _reshowConstant = require("reshow-constant"); | ||
var _popupStore = _interopRequireWildcard(require("../../src/stores/popupStore")); | ||
@@ -32,3 +28,3 @@ | ||
var getPops = function getPops(nodes, name) { | ||
var pops = {}; | ||
var pops = nodes; | ||
nodes.forEach(function (v, k, item) { | ||
@@ -40,6 +36,4 @@ var _v$props; | ||
if ((name || toPool) && toPool !== name) { | ||
return; | ||
pops = pops["delete"](k); | ||
} | ||
pops[k] = v; | ||
}); | ||
@@ -54,17 +48,12 @@ return pops; | ||
otherProps = (0, _objectWithoutPropertiesLoose2["default"])(_ref, _excluded); | ||
var lastReducer = (0, _react.useRef)(); | ||
if (!lastReducer.current) { | ||
lastReducer.current = (0, _reshowFluxBase.createReducer)(function (poolState, action) { | ||
return poolState.set(action.type, action.params); | ||
}, (0, _reshowFlux.Map)()); | ||
} | ||
var _useReduceStore = (0, _reshowFlux.useReduceStore)(function (poolState, action) { | ||
return poolState.set(action.type, action.params); | ||
}, (0, _reshowFlux.Map)()), | ||
poolStore = _useReduceStore[0], | ||
setPoolStore = _useReduceStore[1]; | ||
var _lastReducer$current = lastReducer.current, | ||
poolStore = _lastReducer$current[0], | ||
setPoolStore = _lastReducer$current[1]; | ||
var buildReturn = (0, _reactAtomicMolecule.build)((0, _reactAtomicMolecule.build)(_reshowReturn["default"])({ | ||
store: poolStore | ||
})); | ||
var lastPops = (0, _react.useRef)(); | ||
@@ -77,12 +66,11 @@ var _useState = (0, _react.useState)(), | ||
(0, _react.useEffect)(function () { | ||
if (state[_popupStore.NODE_KEY] !== lastPops.current) { | ||
var nextPops = getPops(state[_popupStore.NODE_KEY], name); | ||
var popsKeys = (0, _reshowConstant.KEYS)(nextPops); | ||
lastPops.current = state[_popupStore.NODE_KEY]; | ||
setPops(popsKeys); | ||
var updateKey = state[_popupStore.SHOW_ONE]; | ||
var nextPops = getPops(state[_popupStore.NODE_KEY], name); | ||
var popsKeys = nextPops.keySeq(); | ||
setPops(function (prev) { | ||
return !(0, _reshowFlux.equal)(prev, popsKeys) ? popsKeys : prev; | ||
}); | ||
var updateKey = state[_popupStore.SHOW_ONE]; | ||
if (nextPops[updateKey]) { | ||
setPoolStore(updateKey, nextPops[updateKey]); | ||
} | ||
if (nextPops.has(updateKey)) { | ||
setPoolStore(updateKey, nextPops.get(updateKey)); | ||
} | ||
@@ -89,0 +77,0 @@ }, [state[_popupStore.NODE_KEY]]); |
{ | ||
"version": "0.15.14", | ||
"version": "0.15.15", | ||
"name": "organism-react-popup", | ||
@@ -4,0 +4,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
133328
3434