@sola-air-ui/compiler 1.0.5 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/index.js +5 -1
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -440,7 +440,11 @@ export function compile(source, options = {}) {
|
|
|
440
440
|
const id = `e${uid++}`;
|
|
441
441
|
domCode += ` const ${id} = document.createTextNode('');\n`;
|
|
442
442
|
domCode += ` ${parentVar}.appendChild(${id});\n`;
|
|
443
|
-
|
|
443
|
+
// Parenthesize expr before `?? ''`: JS forbids mixing ?? with || or && at the
|
|
444
|
+
// same level without explicit grouping (e.g. `col.label || col ?? ''` is a
|
|
445
|
+
// SyntaxError), and any {a || b}-style fallback expression — an extremely
|
|
446
|
+
// common pattern — would otherwise produce invalid generated code.
|
|
447
|
+
domCode += ` createEffect(() => { ${id}.textContent = String((${expr}) ?? ''); });\n`;
|
|
444
448
|
return;
|
|
445
449
|
}
|
|
446
450
|
|