-
Notifications
You must be signed in to change notification settings - Fork 26
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
[BUG] set_data action on "changed" trigger does not have latest row value #2745
Comments
Is this related to #2711 or do you think a separate issue? |
Also just testing and I'm not getting the same behaviour, is your issue based on branch for #2744? Currently whenever I change the combobox neither of the lower variables change. I'm also slightly confused by the toggles, is this basically just to demo with a component other than combo_box (which has its own issues)? |
nvm, have merged #2744 and see same behaviour. I'm pretty sure the reason for this is down to how actions are parsed in advance of being triggered, so triggering two successive actions will not pass changes from the first action to the second. There is currently a workaround in the code to specify However this only applies to action args and we have an inconsistency where some actions use args and other params, e.g. "set_local: var_1: @local.combo_box_1;"
// args: ['var_1', '@local.combo_box_1']
// parameter_list: {} vs "set_data | field_1: value_1; field_2: value_2;"
// args:[],
// parameter_list: {field_1: "value_1", field_2: "value_2"} I can't remember at the code level how we know whether an action is using args vs params (possibly searching for So I think the options here are either to
I might quickly try explore (2) as a better long term option, but if a quick solution needed an alternate PR could be created to add parameter_list case to src/app/shared/components/template/services/instance/template-action.service.ts#L207 |
The issue with using current
|
Thanks @chrismclarke. Your inferences about the debug sheet were correct: #2744 was required for the combo-box to function correctly and manifest the bug, and the toggle bars were included just as an example of a different component that has the same issue.
I think you're right. In addition to the case you've described of successive actions not being able to pass changes (which applies to the case of updating via an intermediary variable as in the debug sheet), there's the case of self-references not being up to date in general, which is handled with a parser workaround to replace I've implemented a version of your suggestion for approach 1. over two PRs:
|
Describe the bug
Some components emit a "changed" event when their value changes. When using this event to trigger
set_data
action, and referencing the component row's value in that action, the value passed to this action does not reflect the latest value, but rather the value before the change (at least forcombo_box
andtoggle_bar
components).App version
0.17.1
To Reproduce
Describe the steps to reproduce this bug.
Debug Sheet(s)
debug_set_data_changed
The combo box and toggle bars in this template are all configured to update the same local variable and dynamic data row. Note that on changes, the local var updates to the expected value, but the dynamic data value is always "behind", being updated to the previous value of the row. This is not an issue with the data-items not rendering the latest value, as debug logs show that the
set_data
action itself is being called with the incorrect value.set.data.changed.bug.mov
notes
From logging out the component's
_row.action_list
, it appears that the arg of theset_local
action remains in unevaluated form, containing a reference to the@local
variable, whereas the param of theset_data
action is already parsed to reflect the current value of that referenced local variable. It is this static value that is then passed through to the action, before it has been re-evaluated to reflect the new value of the row:The text was updated successfully, but these errors were encountered: