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

set-value action does not fire change behavior of related fields #914

Open
flochtililoch opened this issue Jul 31, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@flochtililoch
Copy link
Collaborator

Simple repro case:

<text-field id="foo" value="Foo">
  <behavior trigger="change" action="show" target="bar" />
</text-field>
<text id="bar">Changed!</text>
<text action="set-value" target="foo" new-value="">Clear</text>

Upon pressing the Clear button, the change trigger should cause related change behavior to fire. While the use case described here isn't super useful, this change will comes handy when using the change behavior as a mean to perform custom logic via custom behaviors or custom elements that react to specific events.

@flochtililoch flochtililoch added the bug Something isn't working label Jul 31, 2024
flochtililoch added a commit that referenced this issue Aug 2, 2024
React to text-field value being changed from props, and correctly call
change handler.

Relates to #914.

Note - we currently have only two field types that support "change"
event: `text-field` and `switch`. This PR only addresses the issue with
`text-field` as this component was already migrated to a functional
component, and the use of `useEffect`/`useRef` is trivial. Follow up
needed:
- The switch component should be refactored to a functional component,
then implement the same fix
- The "change" behavior trigger should be extended to other type of
fields (related: #298)



https://github.com/user-attachments/assets/105fb0ac-9239-480a-b86c-e1234a07b28a

---------

Co-authored-by: flochtililoch <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant