Skip to content

options._diff not called for implicit Fragments #317

@marvinhagemeister

Description

@marvinhagemeister
import { render, h,options, Fragment}  from "preact"
import renderToString from "preact-render-to-string"

const oldDiff = options.__b;
options.__b = (vnode) => {
  if (vnode.type === Fragment) {
    console.log(vnode.type === Fragment ? vnode.props:null)
  }
  if (oldDiff) oldDiff(vnode)
}

function App() {
  return <div>
    <h1>test</h1>
    {[
      <p key="1">1</p>,
      <p key="2">2</p>,
      <p key="3">3</p>,
    ]}
  </div>
}

const app = document.getElementById("app");
render(<App />, app)

console.log("=====")

// Fragments not visible in options._diff with RTS
renderToString(<App />);

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