-
Notifications
You must be signed in to change notification settings - Fork 11.5k
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
N8N-4143 Variables and expressions for pin data nodes without execution #3738
N8N-4143 Variables and expressions for pin data nodes without execution #3738
Conversation
62e9b67
to
84c598a
Compare
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.
Thanks for taking this on!
- If we pin a node, connect the next, reference from next to previous using expression, the expression works. If then we add a third node standalone (unconnected), run this third node, and go back to inspect the expression, it now says
[invalid (workflowRunData[parentNode[0]] is undefined)]
- If we pin a node, connect the next, run the next, when opening the NDV or the expression edit modal, there are Vue store state mutation warnings and watcher callback error warnings in the console. These fire multiple times when selecting any option (pindata-based or not) from the variable selector.
@@ -491,7 +520,7 @@ export default mixins( | |||
} | |||
} | |||
|
|||
let tempOutputData; | |||
let tempOutputData: IVariableSelectorOption[] | null; |
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.
This is undefined
here.
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.
Updated types.
* @param {string} nodeName The name of the node to get the data of | ||
* @param {INodeExecutionData} outputData The data of the run to get the data of | ||
* @param {string} filterText Filter text for parameters | ||
* @param {boolean} [useShort=false] Use short notation |
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.
Nit: I would add a small example here. Not immediately obvious what short notation
stands for.
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.
Added description.
} | ||
}); | ||
|
||
if (pinDataOptions.length > 0) { |
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.
Out of scope: I find this hard to follow without spending longer, which makes it difficult to properly check the logic. In the future, we should make an effort to refactor this section and ideally this whole 250-line method. Since we are looking to release, now is probably not the time.
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 found it very hard to follow as well. The code there is very complicated and requires deep business-logic understanding.
I've been doing a lot of trial-and-error work to get to understand what this does and how it interacts with the data.
Further update:
|
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.
Confirmed, those cases are fixed. FYI pushed a small build fix.
…om:n8n-io/n8n into n8n-4143-make-node-parameter-variables-and
@ivov Green connector lines changes are ready to be reviewed. |
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.
This does not seem to work:
- Pin test data to Start, connect to next → connector still grey, no
items
label - Pin test data to standalone node, connect to next → connector still grey, no
items
label - Pin test data to standalone node, connect to next, keep building chain with every node pinned → all connectors still grey, no
items
label in any node
Reviewed: 7feed12
@@ -214,6 +215,8 @@ export const store = new Vuex.Store({ | |||
} | |||
|
|||
state.stateIsDirty = true; | |||
|
|||
dataPinningEventBus.$emit('pin-data', { [payload.node.name]: payload.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.
If I understand, we only need the node name to create the connection, so why do we need to send the payload? Same for others.
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.
We also need the number of items. See total: pinData[nodeName].length
. Thought we'll reuse this at some point so made it a general-purpose event.
connections.forEach((connection) => { | ||
CanvasHelpers.resetConnection(connection); | ||
}); |
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.
Suggestion: connections.forEach(CanvasHelpers.resetConnection);
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.
Updated.
dataPinningEventBus.$on('pin-data', (pinData: PinData) => { | ||
this.addPinDataConnections(pinData); | ||
}); | ||
|
||
dataPinningEventBus.$on('unpin-data', (pinData: PinData) => { | ||
this.removePinDataConnections(pinData); | ||
}); |
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.
- Suggestion:
dataPinningEventBus.$on('event-bus', this.method);
- Why no
$off
indestroyed()
?
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.
- Done.
- Because I forgot. 🥲
43c5670
to
030c9fa
Compare
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.
Amazing work!
https://linear.app/n8n/issue/N8N-4143/make-node-parameter-variables-and-expressions-available-when-using