From 0576308187b9b74f9a43e3debac7f1c2add189e2 Mon Sep 17 00:00:00 2001 From: Hornwitser Date: Tue, 3 Aug 2021 16:09:17 +0200 Subject: [PATCH] Fix unable to clear number fields in web UI (#402) Fix setting a nullable numeric field to blank in the web UI return error that the value cannot be a string due to the field returning null and this being converted to the string "null". --- packages/web_ui/src/components/BaseConfigTree.jsx | 2 +- packages/web_ui/src/components/InstanceConfigTree.jsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/web_ui/src/components/BaseConfigTree.jsx b/packages/web_ui/src/components/BaseConfigTree.jsx index 7f6fd457..e693d9cb 100644 --- a/packages/web_ui/src/components/BaseConfigTree.jsx +++ b/packages/web_ui/src/components/BaseConfigTree.jsx @@ -190,7 +190,7 @@ export default function BaseConfigTree(props) { request = props.setProp(fieldName, prop, value); } else { - request = props.setField(field, value); + request = props.setField(field, value === null ? "" : String(value)); } try { diff --git a/packages/web_ui/src/components/InstanceConfigTree.jsx b/packages/web_ui/src/components/InstanceConfigTree.jsx index eaefa3c2..921694e0 100644 --- a/packages/web_ui/src/components/InstanceConfigTree.jsx +++ b/packages/web_ui/src/components/InstanceConfigTree.jsx @@ -22,7 +22,7 @@ export default function InstanceConfigTree(props) { await libLink.messages.setInstanceConfigField.send(control, { instance_id: props.id, field, - value: String(value), + value, }); }