From 15472311ff755095109df9508337fda132dbee6c Mon Sep 17 00:00:00 2001
From: sophelper <123211521@163.com>
Date: Thu, 5 Nov 2026 23:47:10 +0800
Subject: [PATCH] Fix saving detection methods for steps without conditions
---
.../VVMs/RecipeEditor/EditorNodes.cs | 3 +-
.../VVMs/RecipeEditor/RecipeEditor.xaml | 2 +-
.../RecipeEditor/RecipeEditorViewModel.cs | 20 +++++++++
src/SopHelper.Engine/Sop/SopConfigLoader.cs | 2 +-
tests/RegionEditorSmoke/Program.cs | 41 +++++++++++++++++++
5 files changed, 65 insertions(+), 3 deletions(-)
diff --git a/src/SopHelper.App/VVMs/RecipeEditor/EditorNodes.cs b/src/SopHelper.App/VVMs/RecipeEditor/EditorNodes.cs
index 8b8fbad..59645df 100644
--- a/src/SopHelper.App/VVMs/RecipeEditor/EditorNodes.cs
+++ b/src/SopHelper.App/VVMs/RecipeEditor/EditorNodes.cs
@@ -779,7 +779,8 @@ public class StepNode : EditorNode
private string _description = "";
private int _timeout;
private int _standardDurationMs;
- private ConditionNode? _detection;
+ // 即使 YAML 没有 detection,也保留可编辑对象,供界面写入新选择的方法。
+ private ConditionNode? _detection = new();
/// 步骤号(执行顺序按它升序)
public int Id
diff --git a/src/SopHelper.App/VVMs/RecipeEditor/RecipeEditor.xaml b/src/SopHelper.App/VVMs/RecipeEditor/RecipeEditor.xaml
index 1a8f460..07c47bb 100644
--- a/src/SopHelper.App/VVMs/RecipeEditor/RecipeEditor.xaml
+++ b/src/SopHelper.App/VVMs/RecipeEditor/RecipeEditor.xaml
@@ -230,7 +230,7 @@
-
+