-
Notifications
You must be signed in to change notification settings - Fork 24
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
feat: propagate invalid values to setValue
#252
Conversation
c83cc57
to
c766f0d
Compare
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.
So we now validate twice? We could add an optional error
parameter to setValue
instead.
Not necessarily. In most cases, the validation is only done as linting and not performed on I like the Idea to also provide the validation error in the |
c766f0d
to
61a1dbb
Compare
Added the suggested improvement via 61a1dbb |
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.
✅
|
||
// given | ||
const setValueSpy = sinon.spy(); | ||
const validate = (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.
I know we use this pattern a lot, but these validation functions are pointless. We know exactly if the validation is to return an error or not. So why not just do const validate = () => 'error'
? I'll file a follow-up pull request simplifying this. Our tests should stay focused.
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.
This might have been deliberate in the beginning (e.g. only set "invalid" when the check actually fails. However, we never do the // assume - valid at the start
part, so we should be good to simplify
Invalid values are propagated since bpmn-io/properties-panel#252
Invalid values are propagated since bpmn-io/properties-panel#252
Invalid values are propagated since bpmn-io/properties-panel#252
Whether invalid values are persisted on errors or not should be a concern of the application. This PR introduces that we also propagate invalid values to the app.
Integrates into bpmn-js-properties-panel: bpmn-io/bpmn-js-properties-panel#938
related to bpmn-io/bpmn-js-properties-panel#928
related to camunda/camunda-modeler#3357