Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

preact/debug warnings not thrown because vnode.__k is not set #318

Open
marvinhagemeister opened this issue Oct 7, 2023 · 0 comments
Open
Labels

Comments

@marvinhagemeister
Copy link
Member

In preact/debug we have a branch for detecting invalid children being passed to a vnode:

vnode._children.forEach(child => {
  if (typeof child === 'object' && child && child.type === undefined) {
    const keys = Object.keys(child).join(',');
    throw new Error(
      `Objects are not valid as a child. Encountered an object with the keys {${keys}}.` +
      `\n\n${getOwnerStack(vnode)}`
    );
  }
});

But we never set that property when rendering on the server, so this check is never called.

Steps to reproduce

import "preact/debug";
import { renderToString } from "preact-render-to-string";

// This should throw
renderToString(<div>{{ foo: 123 }}</div>)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant