-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
fix(core): Fix $getWorkflowStaticData
on task runners
#12153
fix(core): Fix $getWorkflowStaticData
on task runners
#12153
Conversation
Codecov ReportAttention: Patch coverage is
📢 Thoughts on this report? Let us know! |
...ages/@n8n/task-runner/src/js-task-runner/built-ins-parser/__tests__/built-ins-parser.test.ts
Outdated
Show resolved
Hide resolved
// if the runner sent back static data, it may have changed, so update it | ||
if (incomingStaticData) { | ||
workflow.setStaticData(incomingStaticData); | ||
workflow.staticData.__dataChanged = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we do this inside the Workflow
class as it's an implementation detail of it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not include it there because the original logic in the constructor did not mark as changed and now both the constructor and this callsite use setStaticData
, i.e. to avoid changing preexisting behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's because the use case is different. The constructor initializes the workflow class, which makes sense that the static data hasn't changed at that point. Here we are explicitly saying "the static data changed, here is the new static data". So the operation is different: initialize static data vs set/override/change static data.
// if the runner sent back static data, it may have changed, so update it | ||
if (incomingStaticData) { | ||
workflow.setStaticData(incomingStaticData); | ||
workflow.staticData.__dataChanged = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's because the use case is different. The constructor initializes the workflow class, which makes sense that the static data hasn't changed at that point. Here we are explicitly saying "the static data changed, here is the new static data". So the operation is different: initialize static data vs set/override/change static data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for addressing the comments 💟 Works nicely now 👏
|
n8n Run #8301
Run Properties:
|
Project |
n8n
|
Branch Review |
pay-2358-getworkflowstaticdata-not-working-on-task-runners
|
Run status |
Passed #8301
|
Run duration | 04m 38s |
Commit |
f596151530: 🌳 🖥️ browsers:node18.12.0-chrome107 🤖 ivov 🗃️ e2e/*
|
Committer | Tomi Turtiainen |
View all properties for this run ↗︎ |
Test results | |
---|---|
Failures |
0
|
Flaky |
1
|
Pending |
0
|
Skipped |
0
|
Passing |
480
|
View all changes introduced in this branch ↗︎ |
✅ All Cypress E2E specs passed |
Co-authored-by: Tomi Turtiainen <10324676+tomi@users.noreply.github.com>
Co-authored-by: Tomi Turtiainen <10324676+tomi@users.noreply.github.com>
Co-authored-by: Tomi Turtiainen <10324676+tomi@users.noreply.github.com>
Got released with |
Co-authored-by: Tomi Turtiainen <10324676+tomi@users.noreply.github.com>
Summary
If the script relies on
$getWorkflowStaticData
, have the runner resolve and also send back to update requester-side.Related Linear tickets, Github issues, and Community forum posts
https://linear.app/n8n/issue/PAY-2358
#12125
Review / Merge checklist
release/backport
(if the PR is an urgent fix that needs to be backported)