Skip to content
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: data-items action value #2807

Merged
merged 4 commits into from
Feb 27, 2025
Merged

Conversation

chrismclarke
Copy link
Member

@chrismclarke chrismclarke commented Feb 22, 2025

PR Checklist

  • PR title descriptive (can be used in release notes)

Description

Fix issue where actions triggered from within a data-items loop would not correctly parse the value of the triggering row this.value variable

Review Notes

Should fix case in debug_data_items_actions_2

Author Notes

This also now added console logs anytime a set_item or set_data action is called

Dev Notes

The issue occurs because due to the way data_items keep their own local variable references, and avoid notifying parent template of inner value changes (updated in #2706). The problem with this is that the parent template is in charge of parsing any this.value instances with the row value.

There were two possible fixes/workarounds, this first would be to move similar logic to the data-items action interceptor to handle replacement, the second would be to pass the current value of the triggering row with the action so that it can be replaced from there. As we already have a triggered_by variable attached to each action it made the most sense to simply use this for replacement instead of looking at the parent templateRowMap

There may be some minor conflicts between here and draft PR #2753. It would probably be good to try and revisit/update #2753 post-merge to make sure the relevant changes are also copied across

Git Issues

Closes #

Screenshots/Videos

Example - Using radio_button_grid inside data_items loop to dynamically set item to match value

Screenity.video.-.Feb.21.2025.mp4

Example - Updated console logs
image

Copy link
Collaborator

@jfmcquade jfmcquade left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, nice straightforward solution. And great to add debug logs for dynamic data updates

Copy link
Collaborator

@esmeetewinkel esmeetewinkel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functional test passed. And I'm so happy to see the dynamic data changes logged in the console :)

@esmeetewinkel esmeetewinkel merged commit a99064b into master Feb 27, 2025
6 checks passed
@esmeetewinkel esmeetewinkel deleted the fix/data-items-action-value branch February 27, 2025 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants