You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 28, 2023. It is now read-only.
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?
The text was updated successfully, but these errors were encountered:
@SantosGuillamot, I've been taking a look at this issue, and I think we can ignore the ref attribute while generating virtual nodes, i.e., something like:
What does this imply? Practically nothing, because even if the ref attribute is not saved in the props generated by running toVdom(), the attribute remains in the DOM node after hydrating; it is not removed.
There could be problems if that node is in any part of the DOM that is unmounted and mounted again, in which case there would be two possibilities:
The third-party library that handles the ref attribute has already been run before hydrate, so the changes it makes are most likely already in the DOM, and everything will work as usual.
This third-party library runs after hydration; if that happens, when unmounting and re-mounting the node, it is most likely that this third-party library will not be executed again, so it doesn't matter if ref is there or not. 🤷
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. Asref
is also used by Preact, I assume at some point it tries to do something likeref.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 theref
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:
TypeError: Cannot create property 'current' on string 'pc.kx.idx.banner1.ljxz'
TypeError: Cannot create property 'current' on string 'MobileMenu'
TypeError: Cannot create property 'current' on string 'MobileMenu'
TypeError: Cannot create property 'current' on string 'MobileMenu'
TypeError: Cannot create property 'current' on string 'nofollow'
TypeError: Cannot create property 'current' on string 'MobileMenu'
TypeError: Cannot create property 'current' on string 'MobileMenu'
TypeError: Cannot create property 'current' on string 'image'
Any idea about how should we approach this?
The text was updated successfully, but these errors were encountered: