diff --git a/packages/react-devtools-shared/src/devtools/views/Components/EditableValue.js b/packages/react-devtools-shared/src/devtools/views/Components/EditableValue.js index 992f2b2dff658..e501c39adee04 100644 --- a/packages/react-devtools-shared/src/devtools/views/Components/EditableValue.js +++ b/packages/react-devtools-shared/src/devtools/views/Components/EditableValue.js @@ -8,8 +8,6 @@ */ import React, {Fragment, useRef} from 'react'; -import Button from '../Button'; -import ButtonIcon from '../ButtonIcon'; import styles from './EditableValue.css'; import {useEditableValue} from '../hooks'; @@ -51,9 +49,7 @@ export default function EditableValue({ switch (event.key) { case 'Enter': - if (isValid && hasPendingChanges) { - overrideValueFn(path, parsedValue); - } + applyChanges(); break; case 'Escape': reset(); @@ -63,6 +59,12 @@ export default function EditableValue({ } }; + const applyChanges = () => { + if (isValid && hasPendingChanges) { + overrideValueFn(path, parsedValue); + } + }; + let placeholder = ''; if (editableValue === undefined) { placeholder = '(undefined)'; @@ -75,6 +77,7 @@ export default function EditableValue({ - {hasPendingChanges && ( - - )} ); }