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
Update last value when triggering nested flows with array values #16180
Conversation
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'm wondering if it would be a good idea to fully isolate the sub-flow's data chain from the parent one except for the payload that is passed to $trigger
(and that should be available in $last
in the first operation after the trigger) by omitting it from context
.
Flows triggered by other flows are kind of like sub-routines and $trigger
is like a list of parameters. In that context, I think it makes sanse to isolate the scope of the parent from the child.
Regarding adding global shortcuts to $*
values in the data chain to the exec
operation, I'm not a huge fan of global variables, but I can see how this might be useful 👍
@nickrum Agreed, users can define the payload, nesting values they require within. However, I wonder if this scope limitation is considered a breaking change as the past behaviour of the
Just as a background, this was a suggestion in https://github.com/directus/docs/pull/185#issuecomment-1291147554 which I thought would be nifty and consistent within the flows data chain. 😄 |
Very good question! Yes, that's exactly how it was supposed to work. That's also how it is documented and how some users understood the feature (#14069). So, I think we should consider it a bug fix and add a notice in case some users relied on the broken behavior.
Ohh, interesting! I thought @rijkvanzanten was suggesting to add the env vars as |
Updated! Users have to define the payload to pass when triggering another flow.
Wow, this is a different interpretation! Was too focused on the run script operation, whereas this would make it truly consistent across the entire data chain. 😄 Thanks! |
@nickrum Just removed the global variables as they're hard to document and might get confusing. 😄 |
…ectus#16180) * Update last payload when triggering array values * Reuse keyedData when triggering other flows * Expose flows data chain variables in run script operation * Fix unit test * Separate context for child flows * Remove global variables from run script operation * Simplify by using omit
Description
Fixes #15653.
$last
updated to the correct payload for array values when triggering another flowkeyedData
in the child flow has a separate context from the parent flowType of Change
Requirements Checklist
If adding a new feature: