preactjs / preact-compat

ATTENTION: The React compatibility layer for Preact has moved to the main preact repo.
http://npm.im/preact-compat
MIT License
950 stars 148 forks source link

$$typeof on Object.prototype #521

Closed fragsalat closed 5 years ago

fragsalat commented 5 years ago

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
marvinhagemeister commented 5 years ago

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 🎉👍