Skip to content

Commit

Permalink
Switch to object to boost performance
Browse files Browse the repository at this point in the history
Using a sparse array to keep track of consecutive row keys has some
major performance hits on certain browsers (i.e. Safari OSX) when using
.slice() (as done by Util.deepCopy).
  • Loading branch information
Pierluigi Cau committed Mar 30, 2016
1 parent 641ab0b commit dfe8c71
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/js/components/AppConfigEditFormComponent.jsx
Expand Up @@ -141,7 +141,7 @@ var AppConfigEditFormComponent = React.createClass({
getErrorMessage: function (fieldId) {
var state = this.state;
var errorIndex = state.errorIndices[fieldId];
if (errorIndex != null && !Util.isArray(errorIndex)) {
if (errorIndex != null && !Util.isObject(errorIndex)) {
return AppFormErrorMessages.getFieldMessage(fieldId, errorIndex);
}
if (state.responseErrorMessages[fieldId] != null) {
Expand Down
2 changes: 1 addition & 1 deletion src/js/stores/AppFormStore.js
Expand Up @@ -252,7 +252,7 @@ function updateErrorIndices(fieldId, value, errorIndices) {
var errorIndex = getValidationErrorIndex(fieldId, value);
if (errorIndex > -1) {
if (value.consecutiveKey != null) {
Util.initKeyValue(errorIndices, fieldId, []);
Util.initKeyValue(errorIndices, fieldId, {});
errorIndices[fieldId][value.consecutiveKey] = errorIndex;
} else {
errorIndices[fieldId] = errorIndex;
Expand Down

0 comments on commit dfe8c71

Please sign in to comment.