From d243395c15ae885d0198ececa8814d0835bf9021 Mon Sep 17 00:00:00 2001 From: Lucio Lelii Date: Tue, 10 Mar 2026 19:24:58 +0100 Subject: [PATCH] Fix dirty state on node parameter edits --- .../shared/nodes/generic-node/generic-node.ts | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/app/shared/nodes/generic-node/generic-node.ts b/src/app/shared/nodes/generic-node/generic-node.ts index 2c0a24b..c653718 100644 --- a/src/app/shared/nodes/generic-node/generic-node.ts +++ b/src/app/shared/nodes/generic-node/generic-node.ts @@ -3,6 +3,7 @@ import { ChangeDetectorRef, Component, HostBinding, inject, Input } from '@angul import { FormsModule } from '@angular/forms'; import { ClassicPreset } from 'rete'; import { ReteModule } from 'rete-angular-plugin/21'; +import { FlowData } from '@models/flow'; import { NodeSettingsDialogService } from '@services/dialogs/node-settings-dialog'; import { EditorStateHolder } from '@stores/flow-editor'; import { FieldRetriever } from '@services/retriever/field-retriever'; @@ -350,7 +351,7 @@ export class GenericNodeComponent { private markFlowDirty() { const flow = this.editorState.currentFlow(); if (!flow) return; - this.editorState.updateData(this.cloneFlowData(flow.data)); + this.editorState.updateData(this.cloneCurrentFlowWithNodeChanges(flow.data)); } private async loadSchemaContext() { @@ -913,6 +914,23 @@ export class GenericNodeComponent { return JSON.parse(JSON.stringify(value)) as T; } + private cloneCurrentFlowWithNodeChanges(flowData: FlowData): FlowData { + const nextFlowData = this.cloneFlowData(flowData); + const nodeData = this.data?.data as Record | undefined; + const blockId = typeof nodeData?.['id'] === 'string' ? nodeData['id'] : null; + if (!blockId) return nextFlowData; + + const block = nextFlowData.blocks.find((item) => item.id === blockId); + if (!block) return nextFlowData; + + const configuredName = toStringOrNull(this.blockConfiguration?.['name']); + block.name = configuredName || this.name || block.name; + block.typeName = this.blockType ?? block.typeName; + block.specificConfiguration = this.cloneFlowData(this.blockConfiguration ?? {}); + + return nextFlowData; + } + private maybeCreateBlockOnServer() { const nodeData = this.data?.data as Record | undefined; if (!nodeData?.['__needsServerCreate']) return;