[FIX] compiler: dynamic value on inputs doesn't turn 0 into empty string

In #1161, we fixed blockdom treating 0 as falsy when patching a value,
which would result in an empty attribute. It turns out that there is
another place where we had the same fallback, which is when we compute a
dynamic attribute value, so while blockdom had the ability to set the
value to 0, when using a dynamic attribute value we would never give it
0 as a value. This commit changes the fallback strategy for dynamic
attribute values to be the same as the one in blockdom.

closes #1358
This commit is contained in:
Samuel Degueldre
2023-02-24 13:53:21 +01:00
committed by Géry Debongnie
parent 276c8a0295
commit a35b9814c0
5 changed files with 73 additions and 9 deletions
@@ -585,7 +585,7 @@ exports[`t-model directive t-model with radio button group in t-foreach 1`] = `
for (let i1 = 0; i1 < l_block2; i1++) {
ctx[\`opt\`] = v_block2[i1];
const key1 = ctx['opt'];
let attr1 = new String((ctx['opt']) || \\"\\");
let attr1 = new String((ctx['opt']) === 0 ? 0 : ((ctx['opt']) || \\"\\"));
let attr2 = ctx['opt'];
const bExpr1 = ctx['state'];
const expr1 = 'group';