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

Refactor: value changed actions #2808

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

chrismclarke
Copy link
Member

@chrismclarke chrismclarke commented Feb 22, 2025

PR Checklist

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

TODO

Description

  • Remove individual component changed action triggers
  • Add changed action trigger to base component, and automatically trigger on any value change
  • Update actions to not trigger when values unchanged (e.g. clicking same value in a combo_box)

Review Notes

If testing debug_data_items_actions_2, should note before actions triggering every value click (not just different), and the template becoming broken if the same value is clicked multiple times in a row. After events only trigger if value clicked different to current value.

It might also be useful to pick one or two components from those changed in this PR and just check the changed action triggers as expected - a few good examples are in example_changed_action, possibly some other sheets too that I'm less aware of

Author Notes

This change shouldn't cause authoring issues, although just to be aware that previously setting the same value on a component would trigger changed actions whereas now it doesn't (although assuming actions are designed to behave the same on each trigger then I can't imagine cases where this would be undesirable)

The one possible minor exception is the plh_parent_point_box which manually triggered click actions before change. Now the default behaviour is to trigger change before click, so if any authoring is order-dependent it may cause issue.

As an added benefit, now all components that are capable of setting values will trigger a changed action when the value is changed - previously this had to be included by developers on a per-component basis

Dev Notes

I've removed all manual calls to trigger changed action from components to call from the base component instead. I've manually checked all updated components to make sure they include extends TemplateBaseComponent and so inherit the change

Git Issues

Closes #

Screenshots/Videos

If useful, provide screenshot or capture to highlight main changes

@chrismclarke chrismclarke changed the title Fix/value changed actions Refactor: value changed actions Feb 22, 2025
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.

Nice, the code changes definitely make sense. Good to have the "changed" action as a fundamental property of components as opposed to handled on a case-by-case basis.

I've double-checked your changes to components: I can see from the changes that the "changed" action is was only being triggered when components were also calling this.setValue(). Conversely, I've checked all instances of components calling this.setValue() to see whether there might be any cases that we don't want to fire "changed" – I'm not sure what case this might by in theory, and can't find any examples on practice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants