-
Any clue why I get this error when I call Alpine.initTree? I've been bashing my head against this all day.
Line 484 says It never happens for me in Firefox or Edge. Only in Chrome and Brave. Chrome was my main browser until I switched to Brave. The error happens less when I run in a private window, but can still happen. I have tried disabling extensions and simplifying my code and it reduces the error rate but not entirely. Actually, it looks like it has entirely removed the problem in a private window. Anyway, it seems that anything that causes a slowdown in the code execution can increase the failure rate, but actually enabling or disable cache doesn't seem to affect it. The context is that I am calling initTree in a Promise callback in a connectedCallback for a custom element. So far so good. The problem doesn't occur until 2 things happen.
There are no Alpine attributes on the html of the custom elements. The elements can be entirely empty (except for the one containing the other). The outer element is processed before the inner element. The error only happens on the inner element. I think that's all there is to it. An intermittent error in Brave/Chrome with extensions installed (though no particular one is to blame), on a nested custom element when Alpine.initTree is called on its shadowRoot. Oh yeah, and I have logged 5000 different things, including everything down the callstack to the error and I never see any difference between when the error happens or not. I thought maybe there would be some kind of timing issue and things are happening in a different order, but I haven't been able to find that. UPDATE: UPDATE2: What would cause Alpine to try to process shadowRoots on Chromium browsers but not in Firefox?UPDATE3: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I should have thought of this sooner, but the answer was to not run initTree again on the nested elements. Actually, I'm not sure how the code works that way, because I thought I would need to initTree inside each shadowRoot, but I guess Alpine actually does see into shadowRoots? I was under the impression it did not. I'm confused. But at least I got my code running! |
Beta Was this translation helpful? Give feedback.
I should have thought of this sooner, but the answer was to not run initTree again on the nested elements. Actually, I'm not sure how the code works that way, because I thought I would need to initTree inside each shadowRoot, but I guess Alpine actually does see into shadowRoots? I was under the impression it did not. I'm confused. But at least I got my code running!