core icon indicating copy to clipboard operation
core copied to clipboard

fix(compiler-vapor): correct execution order of operations

Open zhiyuanzmj opened this issue 5 months ago • 3 comments

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++))
})

zhiyuanzmj avatar May 18 '25 07:05 zhiyuanzmj