-
Notifications
You must be signed in to change notification settings - Fork 31
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: handle null emits #8
base: main
Are you sure you want to change the base?
Conversation
const expression = match.slice(2, -2).trim(); | ||
return parseExpression(expression, values.value); | ||
}); | ||
|
||
if (!computedValue) { |
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.
If computedValue
is a valid falsy value (0, false), it would still return null
. That is not intended in some cases such as subtract or boolean expression.
const valueA = parseExpression(a, values); | ||
if (!valueA) { |
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.
Same as above if valueA
is a valid falsy value.
Because all types are valid, even null (NULL & NOT_NULL operators), we cannot pre-check whether a value is valid or not. I think it is best to leave the responsibility of checking unintended values to the operators. I still can't reproduce your issue with |
This PR verifies when the parsed expression returns a empty value and properly emits
null
, so Directus can take care of the empty field.Closes #7