Skip to content

Conditionally rendered element under fragment in island does not render #502

Description

@crowlKats
/** @jsx h */
/** @jsxFrag Fragment */
import { h, Fragment } from "preact";
import { useState } from "preact/hooks";

export default function Component() {
  const [show, setShow] = useState(false);

  return (
    <>
      Hello
      <div onClick={() => setShow(true)}>
        World
      </div>
      {show && (
        <div>I'm not rendered</div>
      )}
    </>
  );
}

This will error with Uncaught (in promise) DOMException: Node.insertBefore: Child to insert before is not a child of this node on the client when World is clicked.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions