Skip to content

Commit 7153dd5

Browse files
author
Brian Vaughn
committed
Fixed a StyleEditor variable resolution regression
1 parent 33d439f commit 7153dd5

File tree

1 file changed

+6
-4
lines changed
  • packages/react-devtools-shared/src/devtools/views/Components/NativeStyleEditor

1 file changed

+6
-4
lines changed

packages/react-devtools-shared/src/devtools/views/Components/NativeStyleEditor/StyleEditor.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ function Row({
184184
const validateAndSetLocalValue = newValue => {
185185
let isValid = false;
186186
try {
187-
JSON.parse(sanitizeForParse(value));
187+
JSON.parse(sanitizeForParse(newValue));
188188
isValid = true;
189189
} catch (error) {}
190190

@@ -203,7 +203,7 @@ function Row({
203203
};
204204

205205
const submitValueChange = () => {
206-
if (isValueValid) {
206+
if (isAttributeValid && isValueValid) {
207207
const parsedLocalValue = JSON.parse(sanitizeForParse(localValue));
208208
if (value !== parsedLocalValue) {
209209
changeValue(attribute, parsedLocalValue);
@@ -212,8 +212,10 @@ function Row({
212212
};
213213

214214
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+
}
217219
}
218220
};
219221

0 commit comments

Comments
 (0)