Fixed a StyleEditor variable resolution regression
Brian Vaughn committed
Aug 27, 2019 at 12:53 UTC
7153dd516f080a62d3f20024c252869b52678c36
1 file changed
+6
-4
packages/react-devtools-shared/src/devtools/views/Components/NativeStyleEditor/StyleEditor.js
+6
-4
@@ -184,7 +184,7 @@ function Row({
184
const validateAndSetLocalValue = newValue => {
185
let isValid = false;
186
try {
187
- JSON.parse(sanitizeForParse(value));
187
+ JSON.parse(sanitizeForParse(newValue));
188
isValid = true;
189
} catch (error) {}
190
@@ -203,7 +203,7 @@ function Row({
203
};
204
205
const submitValueChange = () => {
206
- if (isValueValid) {
206
+ if (isAttributeValid && isValueValid) {
207
const parsedLocalValue = JSON.parse(sanitizeForParse(localValue));
208
if (value !== parsedLocalValue) {
209
changeValue(attribute, parsedLocalValue);
@@ -212,8 +212,10 @@ function Row({
212
};
213
214
const submitAttributeChange = () => {
215
- if (isAttributeValid && attribute !== localAttribute) {
216
- changeAttribute(attribute, localAttribute, value);
215
+ if (isAttributeValid && isValueValid) {
216
+ if (attribute !== localAttribute) {
217
+ changeAttribute(attribute, localAttribute, value);
218
+ }
219
}
220
};
221