-
Notifications
You must be signed in to change notification settings - Fork 109
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: ensure values not in options clear #835
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some things to clarify, but in general, it looks like a nice direction to keep things clean 👍
Demo also works ✅
packages/form-js-viewer/src/render/hooks/useRestrictedMultiSelectValues.js
Outdated
Show resolved
Hide resolved
packages/form-js-viewer/src/render/components/form-fields/parts/SimpleSelect.js
Outdated
Show resolved
Hide resolved
onChange({ | ||
field, | ||
value: values.filter(v => options.map(o => o.value).includes(v)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As in the comment above having updates here might be unexpected. What would be the disadvantage of only sanitizing value
here and not updating it directly? I guess it would lead to unexpected side effects as we never really clean things up?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah because then you have a mismatch between the form and the actual state. So if you have lets say, a feel expression dependent on this value, it'll still evaluate despite the form not showing that value being selected.
@@ -0,0 +1,32 @@ | |||
import { useEffect } from 'preact/hooks'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see no test added for this new behavior. Did I miss something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There be tests now
6b82707
to
e00d49d
Compare
5e255a7
to
3017a1a
Compare
Thanks for the follow up 👍 |
108240d
to
4c17838
Compare
Closes #817