Closed aravindet closed 6 years ago
Thanks for the report. This looks like a bug in the serialisation, that it doesn't "notice" that the attribute value is a ReactElement and therefore should be serialised / deserialised differently.
I think there's a secondary issue that the serialisation library isn't handling Symbol
s - i don't think it would work anyway because there's no way to serialise a Symbol
that isn't created with Symbol.for(...)
We'll add support for Symbols in general (in js-writer
), and add a fix for props as ReactElements. too.
Fixed in v5.0.1.
I'm testing a component which passes a ReactElement as a prop to another ReactElement:
It keeps regenerating and overwriting the snapshot file on every run.
It turns out that the generated snapshot file contains a syntax error, causing require() to return null, and the loader to assume there's no snapshot. There's string is
footer:{$$typeof:, _owner: null, ...
(note the:,
). This might be because the $$typeof property of a ReactElement is a Symbol.Merely removing the $$typeof property from the snapshot did not fix things; there are several other differences between elements in the
children
vs. elements in other props: