From 9e79166186bfbe4d35c6cdf73ffc2192050dd602 Mon Sep 17 00:00:00 2001 From: limil Date: Mon, 9 Feb 2026 22:40:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=B4=E6=97=B6=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.tsx | 5 ++++- src/components/NodeEditor.tsx | 8 ++++++++ src/components/SettingsEditor.tsx | 7 ++----- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 43656c2..e1b8774 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -124,7 +124,10 @@ function FlowContent(): ReactNode { setNodes((prev) => prev.map((node) => { if (node.data.id === editingNode?.id) { - node.data = {...node.data, ...updatedData} + return { + ...node, + data: {...node.data, ...updatedData} + } } return node; }) diff --git a/src/components/NodeEditor.tsx b/src/components/NodeEditor.tsx index 8c42a77..0bf8de8 100644 --- a/src/components/NodeEditor.tsx +++ b/src/components/NodeEditor.tsx @@ -23,6 +23,14 @@ class Validation { function Validate(updateData : NodeDataUpdate, settings : Settings) : Validation { const errors: string[] = []; + if(!updateData.label) { + errors.push("Label不能是空"); + } + + if(!updateData.privateKey) { + errors.push("privateKey不能是空"); + } + const ipv4Subnet = settings.ipv4Subnet; const ipv4Address = updateData.ipv4Address; if(ipv4Subnet) { diff --git a/src/components/SettingsEditor.tsx b/src/components/SettingsEditor.tsx index 45ae66f..016cf69 100644 --- a/src/components/SettingsEditor.tsx +++ b/src/components/SettingsEditor.tsx @@ -83,11 +83,8 @@ export default function SettingsEditor({ min="30000" max="49151" step="1" - value={listenPort} - onChange={e => { - const value = e.target.valueAsNumber; - setListenPort(isNaN(value) ? 38894 : value); - }} + value={listenPort || ""} + onChange={e => setListenPort(e.target.valueAsNumber)} />