Skip to content

All modes but :full render dynamic values into the wrong holes (vapor_split!/1 ordering) #3

Description

@luis1112

Every mode except runtime: :full renders through Vize.vapor_split!/1, and that function returns statics in document order but slots in another order. PhoenixVapor.Renderer then fills each hole with the wrong value.

render = fn template, assigns ->
  template
  |> PhoenixVapor.render(assigns)
  |> Phoenix.HTML.Safe.to_iodata()
  |> IO.iodata_to_binary()
end

render.(~s(<div :class="outer"><i :class="inner"></i></div>), %{outer: "OUTER", inner: "INNER"})
# got:      <div class="INNER"><i class="OUTER"></i></div>
# expected: <div class="OUTER"><i class="INNER"></i></div>

render.(~s(<div><section><b v-if="on">Y</b></section><span>{{ label }}</span></div>), %{on: true, label: "L"})
# got:      <div><section>L</section><span><b>Y</b></span></div>
# expected: <div><section><b>Y</b></section><span>L</span></div>

The second one changes the tree, not just the values.

Reproduced on phoenix_vapor 0.3.0 and on the inertia-inspired-foundations branch, against vize 0.10.0, 0.11.1 and 0.14.1. Elixir 1.20.0-rc.6, OTP 28.

Filed on the Vize side, where the ordering is lost: elixir-volt/vize_ex#3vapor_ir!/1 is correct, so the information is there; the split drops it.

Raising it here because it affects the ~VUE sigil, .vue server-only, :reactive and :hybrid alike, which leaves no usable path for writing a real screen as a Vue SFC today.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions