preactjs/preact-compat

$$typeof on Object.prototype

fragsalat opened this issue ยท 1 comments

Just recognized that latest preact-compat add's props and $$typeof to the global Object.prototype.
The cause is in the latest alpha version 3 of Preact, a VNode isn't anymore derived from a function but is just an object instead.
Therefore preact-compat adds $$typeof to all object via it's prototype.

https://github.com/developit/preact-compat/blob/master/src/index.js#L45

h('a', null).constructor === Object.constructor

That's because our internal vnode shape changed. It's not a class anymore but a plain object. On top of that we moved compat into core and it can be imported via preact/compat, no additional packages needed ๐Ÿ’ฏ

To fix the error change the import and remove preact-compat via npm uninstall preact-compat ๐ŸŽ‰๐Ÿ‘