solid-start icon indicating copy to clipboard operation
solid-start copied to clipboard

Spread objects with callbacks break the properties

Open juanrgm opened this issue 3 years ago • 1 comments

  • SolidJS v1.6.3: https://playground.solidjs.com/anonymous/d6884656-5176-4a33-a0cd-ab0351648fac
import { render } from "solid-js/web";

function Child(props: { a: number; b: number }) {
  return (
    <div>
      <div>a: {props.a}</div>
      <div>b: {props.b}</div>
    </div>
  );
}

export function Root() {
  const b = () => 2;
  return <Child {...{ a: 1, b: b() }} />;
}

render(() => <Root />, document.getElementById("app")!);
  • SolidJS v1.6.3 + SolidStart v0.2.7: https://stackblitz.com/edit/github-pkoqsx-hxpsu9?file=src%2Froot.tsx
function Child(props: { a: number; b: number }) {
  return (
    <div>
      <div>a: {props.a}</div>
      <div>b: {props.b}</div>
    </div>
  );
}

export default function Root() {
  const b = () => 2;
  return <Child {...{ a: 1, b: b() }} />;
}

juanrgm avatar Dec 08 '22 10:12 juanrgm

fixed with https://github.com/solidjs/solid/pull/1403

orenelbaum avatar Dec 08 '22 15:12 orenelbaum