question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Object as children does not show any error or warning

See original GitHub issue

When an object is passed as children to be rendered there’s no warning or error and it doesn’t render anything. I’m not sure if the issue is related to preact or fresh.

Example code

const activities = [
  { id: "1", name: "Wake up", date: new Date() },
  { id: "2", name: "Eat breakfast", date: new Date() },
  { id: "3", name: "Go to work", date: new Date() },
  { id: "4", name: "Go to sleep", date: new Date() },
];

export default function Home() {
  return (
    <ul>
      {activities.map((activity) => (
        <li key={activity.id}>{activity}</li>
      ))}
    </ul>
  );
}

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
lucacasonatocommented, Sep 12, 2022

The rendering inconsistency is a bug in preact-render-to-string. See https://github.com/preactjs/preact-render-to-string/issues/245 for that issue.

#761 will fix this being silently ignored. Instead an error will be thrown / warning logged in the future.

1reaction
JoviDeCroockcommented, Oct 13, 2022

@lucacasonato this should be published as part of preact-render-to-string 5.2.5

Read more comments on GitHub >

github_iconTop Results From Across the Web

Resolving Error: "Objects are not valid as a React child"
The “Objects are not valid as a React child” error might mean that a few different things are going wrong. ⚠️ Potential issues:...
Read more >
Understanding the "Objects are not valid as a react child" Error ...
The "Objects are not valid as a React child" error happens when trying to render a collection of data by mistakenly returning the...
Read more >
Invariant Violation: Objects are not valid as a React child
This error usually happens because a function involved in dispatching an event has been given an unexpected object type (i.e passing an object...
Read more >
Object spreads with nested children gives unwanted key error.
I believe the following case should not result with a key error. So I would like to know if this is correct behaviour...
Read more >
Handling the 'Object Does Not Exist' Error - SmartBear Support
The “Object Does Not Exist” message indicates that the tested application differs from the state it had during test recording or test creation....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found