core
core copied to clipboard
fix(compiler-vapor): correct execution order of operations
Example:
<script setup>
let foo = 1
</script>
<template>
<div :id="foo">{{ foo++ }}</div>
</template>
Compiler:
Before ❌
const n0 = t0()
const x0 = _child(n0)
_renderEffect(() => {
_setText(x0, _toDisplayString(_ctx.foo++))
_setProp(n0, "id", _ctx.foo)
})
After ✅
const n0 = t0()
const x0 = _child(n0)
_renderEffect(() => {
_setProp(n0, "id", _ctx.foo)
_setText(x0, _toDisplayString(_ctx.foo++))
})