core icon indicating copy to clipboard operation
core copied to clipboard

feat(runtime-vapor): add normalizeNode to support non-block nodes

Open zhiyuanzmj opened this issue 6 months ago • 3 comments

Some times functional component maybe return any types:

export default () => {
  return [null, 123, 'foo', true, <div />]
}

I think we should use document.createTextNode(String(node)) to prevent insertion errors.
Just like vnode's normalizeVNode: https://github.com/vuejs/core/blob/56be3dd4db10d4d8d5e10eb53df795143182aaac/packages/runtime-core/src/vnode.ts#L784

REPL

Virtual DOM

Vapor Mode

zhiyuanzmj avatar May 07 '25 07:05 zhiyuanzmj