Skip to content

Commit

Permalink
Fixed a StyleEditor variable resolution regression
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Vaughn committed Aug 27, 2019
1 parent 33d439f commit 7153dd5
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ function Row({
const validateAndSetLocalValue = newValue => {
let isValid = false;
try {
JSON.parse(sanitizeForParse(value));
JSON.parse(sanitizeForParse(newValue));
isValid = true;
} catch (error) {}

Expand All @@ -203,7 +203,7 @@ function Row({
};

const submitValueChange = () => {
if (isValueValid) {
if (isAttributeValid && isValueValid) {
const parsedLocalValue = JSON.parse(sanitizeForParse(localValue));
if (value !== parsedLocalValue) {
changeValue(attribute, parsedLocalValue);
Expand All @@ -212,8 +212,10 @@ function Row({
};

const submitAttributeChange = () => {
if (isAttributeValid && attribute !== localAttribute) {
changeAttribute(attribute, localAttribute, value);
if (isAttributeValid && isValueValid) {
if (attribute !== localAttribute) {
changeAttribute(attribute, localAttribute, value);
}
}
};

Expand Down

0 comments on commit 7153dd5

Please sign in to comment.