-
Notifications
You must be signed in to change notification settings - Fork 9
How to deal with ref attributes? #116
Description
I was running the stress tests on some sites, and I found the same hydrationError in all of them: TypeError: Cannot create property 'current' on string 'MobileMenu' (the string varies between them).
I've been triaging it, and I believe this error occurs because they have a ref attribute in some HTML elements. As ref is also used by Preact, I assume at some point it tries to do something like ref.current === 'string' and produces this error.
Some sites are adding ref because they use other libraries like Vuejs or plugins like Curator.io, which also need the ref attribute.
This only happens when I run the stress testing script. If I paste the manual script into the browser console, I cannot reproduce it. I've checked the vDom with @DAreRodz, and the ref property is there, but it doesn't throw any error.
I tested 4000 sites and 8 of them had this issue:
- kxbox.com:
TypeError: Cannot create property 'current' on string 'pc.kx.idx.banner1.ljxz' - jhamiba.com:
TypeError: Cannot create property 'current' on string 'MobileMenu' - meidouya.com:
TypeError: Cannot create property 'current' on string 'MobileMenu' - wpdaxue.com:
TypeError: Cannot create property 'current' on string 'MobileMenu' - 22vd.com:
TypeError: Cannot create property 'current' on string 'nofollow' - knewsmart.com:
TypeError: Cannot create property 'current' on string 'MobileMenu' - mfisp.com:
TypeError: Cannot create property 'current' on string 'MobileMenu' - pro-q.it:
TypeError: Cannot create property 'current' on string 'image'
Any idea about how should we approach this?