mirror of
https://github.com/n8n-io/n8n.git
synced 2026-10-12 02:19:43 +00:00
fix(editor): Skip orphan pin cleanup when deleted node has no pinned data (no-changelog) (#32098)
Co-authored-by: Claude Opus 4.8 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
d0be4f7554
commit
e6d1ceff69
+13
@@ -431,6 +431,19 @@ describe('getPinDataSize', () => {
|
||||
expect(pinData.pinnedDataByNodeName.value.Other).toBeDefined();
|
||||
});
|
||||
|
||||
it('skips cleanup when the deleted node has no pinned data', () => {
|
||||
const { pinData, fire } = createPinDataWithNodesChange();
|
||||
pinData.pinNodeData('Other', [{ json: { y: 2 } }] as INodeExecutionData[]);
|
||||
const hookSpy = vi.fn();
|
||||
pinData.onPinnedDataChange(hookSpy);
|
||||
const before = pinData.pinnedDataByNodeName.value;
|
||||
|
||||
fire({ action: CHANGE_ACTION.DELETE, payload: { id: 'node-id-1', name: 'Target' } });
|
||||
|
||||
expect(hookSpy).not.toHaveBeenCalled();
|
||||
expect(pinData.pinnedDataByNodeName.value).toBe(before);
|
||||
});
|
||||
|
||||
it('does nothing when DELETE has no node name (removeAllNodes)', () => {
|
||||
const { pinData, fire } = createPinDataWithNodesChange();
|
||||
pinData.pinNodeData('Target', [{ json: { x: 1 } }] as INodeExecutionData[]);
|
||||
|
||||
+4
-1
@@ -227,7 +227,10 @@ export function useWorkflowDocumentPinData(deps: WorkflowDocumentPinDataDeps) {
|
||||
// useWorkflowDocumentNodes via an injected `unpinNodeData` dep;
|
||||
// pulling it into the pinData subscriber means nodes doesn't need
|
||||
// to know about pinData at all (breaks the construction cycle).
|
||||
if (payload.name) applyUnpin(payload.name);
|
||||
// Skipped when the node has no pinned data: unpinning unconditionally
|
||||
// would replace the pin-data object identity (dirtying every computed
|
||||
// that reads it) and fire a spurious DELETE pin event.
|
||||
if (payload.name && pinnedDataByNodeName.value[payload.name]) applyUnpin(payload.name);
|
||||
break;
|
||||
}
|
||||
case CHANGE_ACTION.SET: {
|
||||
|
||||
Reference in New Issue
Block a user