From bbf1247f807c3f9ebf43559293f3efc1b079c2a5 Mon Sep 17 00:00:00 2001 From: yyh Date: Sat, 17 Jan 2026 17:52:00 +0800 Subject: [PATCH] fix(skill-editor): compare content with original to determine dirty state Previously, any edit would mark the file as dirty even if the content was restored to its original state. Now we compare against the original content and clear the dirty flag when they match. --- .../components/workflow/skill/skill-doc-editor.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/web/app/components/workflow/skill/skill-doc-editor.tsx b/web/app/components/workflow/skill/skill-doc-editor.tsx index 3d8bbe0756..553f8455e7 100644 --- a/web/app/components/workflow/skill/skill-doc-editor.tsx +++ b/web/app/components/workflow/skill/skill-doc-editor.tsx @@ -99,9 +99,16 @@ const SkillDocEditor: FC = () => { const handleEditorChange = useCallback((value: string | undefined) => { if (!activeTabId || !isEditable) return - storeApi.getState().setDraftContent(activeTabId, value ?? '') + const newValue = value ?? '' + const originalContent = fileContent?.content ?? '' + + if (newValue === originalContent) + storeApi.getState().clearDraftContent(activeTabId) + else + storeApi.getState().setDraftContent(activeTabId, newValue) + storeApi.getState().pinTab(activeTabId) - }, [activeTabId, isEditable, storeApi]) + }, [activeTabId, isEditable, storeApi, fileContent?.content]) const handleSave = useCallback(async () => { if (!activeTabId || !appId || !isEditable)