diff --git a/src/ValueNodes.tsx b/src/ValueNodes.tsx index c8e1387..8152596 100644 --- a/src/ValueNodes.tsx +++ b/src/ValueNodes.tsx @@ -143,58 +143,56 @@ export const StringEdit: React.FC = ({ ) } -export const StringValue: React.FC = ({ - isEditing, - path, - enumType, - ...props -}) => { - const { getStyles } = useTheme() +export const StringValue: React.FC = + React.memo(({ isEditing, path, enumType, ...props }) => { + const { getStyles } = useTheme() - const pathString = toPathString(path) - - const { value, setValue, nodeData, handleEdit, handleKeyboard, keyboardCommon } = props - - if (isEditing && enumType) { - return ( -
- - -
+ const pathString = toPathString(path) + + const { value, setValue, nodeData, handleEdit, handleKeyboard, keyboardCommon } = props + + if (isEditing && enumType) { + return ( +
+ + +
+ ) + } + + return isEditing ? ( + >} + /> + ) : ( + ) - } + }) - return isEditing ? ( - >} - /> - ) : ( - - ) -} +StringValue.displayName = 'StringValue' export const NumberValue: React.FC = ({ value,