Skip to content

fix(editor): Changes to workflow after execution should not affect logs #14703

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

autologie
Copy link
Contributor

@autologie autologie commented Apr 17, 2025

Summary

This PR fixes the bug that changes to workflow on the canvas, such as deactivating or deleting nodes, affects logs shown in the logs view.

The fix is implemented through:

  • Detaching sub components in the logs view from workflow store and passing down data from the top level LogsView component as props
  • Creating an immutable copy of the execution data in LogsView component, which also includes workflow at the point of execution.

Related Linear tickets, Github issues, and Community forum posts

https://linear.app/n8n/issue/SUG-42/bug-changes-to-workflow-after-execution-should-not-affect-logs

Review / Merge checklist

  • PR title and summary are descriptive. (conventions)
  • Docs updated or follow-up ticket created.
  • Tests included.
  • PR Labeled with release/backport (if the PR is an urgent fix that needs to be backported)

@n8n-assistant n8n-assistant bot added the n8n team Authored by the n8n team label Apr 17, 2025
Base automatically changed from sug-24-log-details-panel to master April 17, 2025 11:44
@autologie autologie force-pushed the sug-42-immutable-logs branch from d60c9d5 to 16ed16b Compare April 17, 2025 13:30
@autologie autologie marked this pull request as ready for review April 17, 2025 15:26
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting difficult to keep compatibility with the utilties for the current logs view, so I'm extracting relevant functions to a new file and making changes here rather than modifying the existing ones.

icon="copy"
type="secondary"
size="mini"
text="true"
:text="true"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolve a warning message from Vue

Copy link

@mrge-io mrge-io bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mrge found 11 issues across 22 files. View them in mrge.io

Comment on lines -57 to -58
const workflow = computed(() => workflowsStore.getCurrentWorkflow());
const executionTree = computed<TreeNode[]>(() =>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extracted data related logic to useExecutionData

@autologie autologie requested a review from RicardoE105 April 22, 2025 07:36
@mutdmour mutdmour requested review from a team and r00gm April 22, 2025 11:12
useThrottleFn(
() => {
// Create deep copy to disable reactivity
execData.value = deepCopy(workflowsStore.workflowExecutionData ?? undefined);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is the deepCopy needed here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two reasons:

  • For throttling to work, I don't want the workflowExecutionData to reflect updates made in the store when websocket events are received.
  • Editing workflow in the canvas after an execution should not affect what is shown in the logs view. Without copying, workflow data in workflowExecutionData get updated as the user deletes or disables nodes.

However it's not great to copy execution data especially if it's large. I tried few different APIs such as markRaw, toRaw but wasn't helpful for deeply disabling reactivity. If you have different approaches in mind that I can try, please let me know.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which i had a better solution, i was doing some digging and the only thing i found is vuejs/core#5303 (comment)

but since we are already using our own version of deepCopy better to stick with it

@autologie autologie requested a review from r00gm April 22, 2025 14:51
@RicardoE105 RicardoE105 requested a review from mutdmour April 22, 2025 23:04
@RicardoE105 RicardoE105 removed their request for review April 22, 2025 23:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
n8n team Authored by the n8n team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants