v8.1.18
In Perspective (haven’t checked Vision), if you bind a component prop to an expression such as <condition1> && <condition2>
and <condition1>
is bad quality and <condition2>
is good quality, the result is different based on the value of <condition2>
.
If <condition2>
is false, the return is good quality and false
If <condition2>
is true, the return is bad quality and false
Simple test View JSON below where the View has 3 custom props:
cond1: this is bound to a bogus tag and is therefore bad quality
cond2: this is a simple unbound bool value
expr: this is bound to {view.custom.cond1} && {view.custom.cond2}
If you toggle the value of cond2, the expr will change between false bad quality to false good quality. You can even use isGood
to test this as well.
This makes finding bad conditions in expressions REALLY hard!
I assume it’s got something to do with conditional statements being short-circuited by any false conditions
{
"custom": {
"cond1": null,
"cond2": false,
"expr": false
},
"params": {},
"propConfig": {
"custom.cond1": {
"binding": {
"config": {
"fallbackDelay": 2.5,
"mode": "direct",
"tagPath": "asdasd"
},
"type": "tag"
},
"persistent": true
},
"custom.cond2": {
"persistent": true
},
"custom.expr": {
"binding": {
"config": {
"expression": "{view.custom.cond1} \u0026\u0026 {view.custom.cond2}"
},
"type": "expr"
},
"persistent": true
}
},
"props": {},
"root": {
"meta": {
"name": "root"
},
"props": {
"direction": "column"
},
"type": "ia.container.flex"
}
}