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

When you have 2 logic actions (in the same trigger) that set a variable. And you delete the top one. The 2nd one will get the JSON-logic value of the deleted one. #5040

Open
Tracked by #5032
vaszig opened this issue Jan 27, 2025 · 1 comment · May be fixed by #5127
Assignees
Milestone

Comments

@vaszig
Copy link
Contributor

vaszig commented Jan 27, 2025

No description provided.

@sergei-maertens
Copy link
Member

I suspect this is some react key issue

@viktorvanwijk viktorvanwijk moved this from Todo to In Progress in Development Feb 27, 2025
viktorvanwijk added a commit that referenced this issue Feb 27, 2025
…same trigger

When two variable-set actions are configured for the same trigger, deleting the first action will result in the second one getting the JSON-logic value of the first one.
viktorvanwijk added a commit that referenced this issue Feb 27, 2025
Keys tell React which array item each component corresponds to, so that it can match them up later. They must be unique, see https://react.dev/learn/rendering-lists#keeping-list-items-in-order-with-key

Previously, the key was set to the index of the action as it occurred in the actions array. After deletion of an action, the ActionSet would be regenerated, and the keys for the actions will start counting from 0 again. This means the keys were not unique, and it created unexpected behaviour when deleting an action.

Now, each Action will get a unique key using getUniqueRandomString.
@viktorvanwijk viktorvanwijk linked a pull request Feb 27, 2025 that will close this issue
10 tasks
viktorvanwijk added a commit that referenced this issue Feb 27, 2025
Keys tell React which array item each component corresponds to, so that it can match them up later. They must be unique, see https://react.dev/learn/rendering-lists#keeping-list-items-in-order-with-key

Previously, the key was set to the index of the action as it occurred in the actions array. After deletion of an action, the ActionSet would be regenerated, and the keys for the actions will start counting from 0 again. This means the keys were not unique, and it created unexpected behaviour when deleting an action.

Now, each Action will get a unique key using getUniqueRandomString.
@viktorvanwijk viktorvanwijk moved this from In Progress to Implemented in Development Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Implemented
Development

Successfully merging a pull request may close this issue.

3 participants