victory-core
Advanced tools
Comparing version 35.3.0 to 35.3.1
@@ -75,3 +75,3 @@ import _isNil from "lodash/isNil"; | ||
_this.externalMutations = _this.getExternalMutations(props); | ||
_this.calculatedState = _this.getStateChanges(props, calculatedValues); | ||
_this.calculatedState = _this.getStateChanges(props); | ||
return _this; | ||
@@ -83,3 +83,2 @@ } | ||
value: function shouldComponentUpdate(nextProps) { | ||
var calculatedValues = this.getCalculatedValues(nextProps); | ||
var externalMutations = this.getExternalMutations(nextProps); | ||
@@ -90,3 +89,3 @@ var animating = this.props.animating || this.props.animate; | ||
if (animating || newMutation) { | ||
this.cacheValues(calculatedValues); | ||
this.cacheValues(this.getCalculatedValues(nextProps)); | ||
this.externalMutations = externalMutations; | ||
@@ -97,5 +96,6 @@ this.applyExternalMutations(nextProps, externalMutations); | ||
var calculatedState = this.getStateChanges(nextProps, calculatedValues); | ||
var calculatedState = this.getStateChanges(nextProps); | ||
if (!isEqual(this.calculatedState, calculatedState)) { | ||
this.cacheValues(this.getCalculatedValues(nextProps)); | ||
return true; | ||
@@ -105,2 +105,3 @@ } | ||
if (!isEqual(this.props, nextProps)) { | ||
this.cacheValues(this.getCalculatedValues(nextProps)); | ||
return true; | ||
@@ -114,6 +115,4 @@ } | ||
value: function componentDidUpdate(prevProps) { | ||
var calculatedValues = this.getCalculatedValues(prevProps); | ||
var calculatedState = this.getStateChanges(prevProps, calculatedValues); | ||
var calculatedState = this.getStateChanges(prevProps); | ||
this.calculatedState = calculatedState; | ||
this.cacheValues(calculatedValues); | ||
} // compile all state changes from own and parent state. Order doesn't matter, as any state | ||
@@ -124,9 +123,6 @@ // state change should trigger a re-render | ||
key: "getStateChanges", | ||
value: function getStateChanges(props, calculatedValues) { | ||
value: function getStateChanges(props) { | ||
var _this2 = this; | ||
var hasEvents = calculatedValues.hasEvents, | ||
getSharedEventState = calculatedValues.getSharedEventState; | ||
if (!hasEvents) { | ||
if (!this.hasEvents) { | ||
return {}; | ||
@@ -136,3 +132,3 @@ } | ||
var getState = function (key, type) { | ||
var result = _defaults({}, _this2.getEventState(key, type), getSharedEventState(key, type)); | ||
var result = _defaults({}, _this2.getEventState(key, type), _this2.getSharedEventState(key, type)); | ||
@@ -149,3 +145,3 @@ return _isEmpty(result) ? undefined : result; | ||
} else { | ||
return component.index !== undefined ? getState(component.index, component.name) : calculatedValues.dataKeys.map(function (key) { | ||
return component.index !== undefined ? getState(component.index, component.name) : _this2.dataKeys.map(function (key) { | ||
return getState(key, component.name); | ||
@@ -152,0 +148,0 @@ }).filter(Boolean); |
@@ -227,3 +227,3 @@ import _includes from "lodash/includes"; | ||
if (eventReturn) { | ||
if (!_isEmpty(eventReturn)) { | ||
var callbacks = compileCallbacks(eventReturn); | ||
@@ -230,0 +230,0 @@ |
@@ -98,3 +98,3 @@ "use strict"; | ||
_this.externalMutations = _this.getExternalMutations(props); | ||
_this.calculatedState = _this.getStateChanges(props, calculatedValues); | ||
_this.calculatedState = _this.getStateChanges(props); | ||
return _this; | ||
@@ -106,3 +106,2 @@ } | ||
value: function shouldComponentUpdate(nextProps) { | ||
var calculatedValues = this.getCalculatedValues(nextProps); | ||
var externalMutations = this.getExternalMutations(nextProps); | ||
@@ -113,3 +112,3 @@ var animating = this.props.animating || this.props.animate; | ||
if (animating || newMutation) { | ||
this.cacheValues(calculatedValues); | ||
this.cacheValues(this.getCalculatedValues(nextProps)); | ||
this.externalMutations = externalMutations; | ||
@@ -120,5 +119,6 @@ this.applyExternalMutations(nextProps, externalMutations); | ||
var calculatedState = this.getStateChanges(nextProps, calculatedValues); | ||
var calculatedState = this.getStateChanges(nextProps); | ||
if (!(0, _reactFastCompare.default)(this.calculatedState, calculatedState)) { | ||
this.cacheValues(this.getCalculatedValues(nextProps)); | ||
return true; | ||
@@ -128,2 +128,3 @@ } | ||
if (!(0, _reactFastCompare.default)(this.props, nextProps)) { | ||
this.cacheValues(this.getCalculatedValues(nextProps)); | ||
return true; | ||
@@ -137,6 +138,4 @@ } | ||
value: function componentDidUpdate(prevProps) { | ||
var calculatedValues = this.getCalculatedValues(prevProps); | ||
var calculatedState = this.getStateChanges(prevProps, calculatedValues); | ||
var calculatedState = this.getStateChanges(prevProps); | ||
this.calculatedState = calculatedState; | ||
this.cacheValues(calculatedValues); | ||
} // compile all state changes from own and parent state. Order doesn't matter, as any state | ||
@@ -147,9 +146,6 @@ // state change should trigger a re-render | ||
key: "getStateChanges", | ||
value: function getStateChanges(props, calculatedValues) { | ||
value: function getStateChanges(props) { | ||
var _this2 = this; | ||
var hasEvents = calculatedValues.hasEvents, | ||
getSharedEventState = calculatedValues.getSharedEventState; | ||
if (!hasEvents) { | ||
if (!this.hasEvents) { | ||
return {}; | ||
@@ -159,3 +155,3 @@ } | ||
var getState = function (key, type) { | ||
var result = (0, _defaults2.default)({}, _this2.getEventState(key, type), getSharedEventState(key, type)); | ||
var result = (0, _defaults2.default)({}, _this2.getEventState(key, type), _this2.getSharedEventState(key, type)); | ||
return (0, _isEmpty2.default)(result) ? undefined : result; | ||
@@ -171,3 +167,3 @@ }; | ||
} else { | ||
return component.index !== undefined ? getState(component.index, component.name) : calculatedValues.dataKeys.map(function (key) { | ||
return component.index !== undefined ? getState(component.index, component.name) : _this2.dataKeys.map(function (key) { | ||
return getState(key, component.name); | ||
@@ -174,0 +170,0 @@ }).filter(Boolean); |
@@ -242,3 +242,3 @@ "use strict"; | ||
if (eventReturn) { | ||
if (!(0, _isEmpty2.default)(eventReturn)) { | ||
var callbacks = compileCallbacks(eventReturn); | ||
@@ -245,0 +245,0 @@ |
{ | ||
"name": "victory-core", | ||
"version": "35.3.0", | ||
"version": "35.3.1", | ||
"description": "Victory Core", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -32,7 +32,6 @@ import React from "react"; | ||
this.externalMutations = this.getExternalMutations(props); | ||
this.calculatedState = this.getStateChanges(props, calculatedValues); | ||
this.calculatedState = this.getStateChanges(props); | ||
} | ||
shouldComponentUpdate(nextProps) { | ||
const calculatedValues = this.getCalculatedValues(nextProps); | ||
const externalMutations = this.getExternalMutations(nextProps); | ||
@@ -42,3 +41,3 @@ const animating = this.props.animating || this.props.animate; | ||
if (animating || newMutation) { | ||
this.cacheValues(calculatedValues); | ||
this.cacheValues(this.getCalculatedValues(nextProps)); | ||
this.externalMutations = externalMutations; | ||
@@ -48,7 +47,9 @@ this.applyExternalMutations(nextProps, externalMutations); | ||
} | ||
const calculatedState = this.getStateChanges(nextProps, calculatedValues); | ||
const calculatedState = this.getStateChanges(nextProps); | ||
if (!isEqual(this.calculatedState, calculatedState)) { | ||
this.cacheValues(this.getCalculatedValues(nextProps)); | ||
return true; | ||
} | ||
if (!isEqual(this.props, nextProps)) { | ||
this.cacheValues(this.getCalculatedValues(nextProps)); | ||
return true; | ||
@@ -60,6 +61,4 @@ } | ||
componentDidUpdate(prevProps) { | ||
const calculatedValues = this.getCalculatedValues(prevProps); | ||
const calculatedState = this.getStateChanges(prevProps, calculatedValues); | ||
const calculatedState = this.getStateChanges(prevProps); | ||
this.calculatedState = calculatedState; | ||
this.cacheValues(calculatedValues); | ||
} | ||
@@ -69,5 +68,4 @@ | ||
// state change should trigger a re-render | ||
getStateChanges(props, calculatedValues) { | ||
const { hasEvents, getSharedEventState } = calculatedValues; | ||
if (!hasEvents) { | ||
getStateChanges(props) { | ||
if (!this.hasEvents) { | ||
return {}; | ||
@@ -77,3 +75,7 @@ } | ||
const getState = (key, type) => { | ||
const result = defaults({}, this.getEventState(key, type), getSharedEventState(key, type)); | ||
const result = defaults( | ||
{}, | ||
this.getEventState(key, type), | ||
this.getSharedEventState(key, type) | ||
); | ||
return isEmpty(result) ? undefined : result; | ||
@@ -92,5 +94,3 @@ }; | ||
? getState(component.index, component.name) | ||
: calculatedValues.dataKeys | ||
.map((key) => getState(key, component.name)) | ||
.filter(Boolean); | ||
: this.dataKeys.map((key) => getState(key, component.name)).filter(Boolean); | ||
} | ||
@@ -97,0 +97,0 @@ }) |
@@ -204,3 +204,3 @@ import { assign, isEmpty, isFunction, without, pickBy, uniq, includes } from "lodash"; | ||
const eventReturn = events[eventName](evt, childProps, eventKey, this); | ||
if (eventReturn) { | ||
if (!isEmpty(eventReturn)) { | ||
const callbacks = compileCallbacks(eventReturn); | ||
@@ -207,0 +207,0 @@ this.setState(parseEventReturn(eventReturn, eventKey), callbacks); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
2264035
30832