-
Notifications
You must be signed in to change notification settings - Fork 3.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 updating the Subflow name during a copy #4809
base: master
Are you sure you want to change the base?
Conversation
* | ||
* @param {object} sf The Subflow to add. | ||
* @param {boolean|undefined} createNewIds Whether to update the name. | ||
*/ | ||
function addSubflow(sf, createNewIds) { |
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.
Is createNewIds
supposed to only update the name or also the id (inside this function)?
Note: this function is exported.
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.
It is probably just a lazily named argument because it is createNewIds
from the calling function. The ids will have already been regenerated by the time this is called - on the basis that it is a duplicate subflow we're importing a copy. As a copy, we want to update the name to make sure its unique.
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.
Ok thanks, maybe we can call it something else?
What does that result in? When I test with 4.0.1, if I import an existing subflow and request to import a copy, I get the copy with the updated name. It looks like it's working. Please can you provide the steps needed to reproduce the issue. We can argue over whether the copy numbering should start with 1 or 2... but that's a separate matter for this PR. |
If you import the subflow below for the first time you will have the name of Subflow (tab) [{"id":"fce385f33b15f673","type":"subflow","name":"Subflow 1","info":"","in":[],"out":[]},{"id":"1a65476b8e0791f5","type":"subflow:fce385f33b15f673","z":"15cdbf1d258ebb57","name":"","x":380,"y":540,"wires":[]}] And now if you re-import it, copy the subflow (tab), you will also have the name |
Co-authored-by: Nick O'Leary <[email protected]>
Proposed changes
Fix updating the Subflow name during a copy:
addSubflow
causescreateNewIds
is false.Related PR: #4757.
Checklist
npm run test
to verify the unit tests pass