From 7153dd516f080a62d3f20024c252869b52678c36 Mon Sep 17 00:00:00 2001 From: Brian Vaughn Date: Tue, 27 Aug 2019 12:53:38 -0700 Subject: [PATCH] Fixed a StyleEditor variable resolution regression --- .../views/Components/NativeStyleEditor/StyleEditor.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/react-devtools-shared/src/devtools/views/Components/NativeStyleEditor/StyleEditor.js b/packages/react-devtools-shared/src/devtools/views/Components/NativeStyleEditor/StyleEditor.js index d48c96e977795..2a08e99cf4e71 100644 --- a/packages/react-devtools-shared/src/devtools/views/Components/NativeStyleEditor/StyleEditor.js +++ b/packages/react-devtools-shared/src/devtools/views/Components/NativeStyleEditor/StyleEditor.js @@ -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) {} @@ -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); @@ -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); + } } };