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
I'm right now trying to integrate a Custom Element that has been created via preact-custom-element into a Svelte application.
Whenever the CE is rendered by svelte an error comes up that emerges at the "place" where Svelte hands over properties/attributes to the Custom Element:
("Uncaught TypeError: Cannot read properties of undefined (reading 'props')")
The place this error is thrown is this line of code:
The function that is responsible always reads (get) the value from the custom element (via the typeof statement) before it sets the value, while preact-custom-element assumes that the value is set before it is read.
Please let me know if my analysis makes sense and if you'd consider this something that should be fixed here or rather in the svelte implementation!
The text was updated successfully, but these errors were encountered:
I'm right now trying to integrate a Custom Element that has been created via preact-custom-element into a Svelte application.
Whenever the CE is rendered by svelte an error comes up that emerges at the "place" where Svelte hands over properties/attributes to the Custom Element:
("Uncaught TypeError: Cannot read properties of undefined (reading 'props')")
The place this error is thrown is this line of code:
(https://github.com/preactjs/preact-custom-element/blob/master/src/index.js#L27)
My understanding is that preact-custom-element assumes that a property value will always be set before it is ever read.
Therefore the if statement in line 30 that checks for an initialized vdom (https://github.com/preactjs/preact-custom-element/blob/master/src/index.js#L30).
Now the problem gets clearer when we look at the code where svelte assigns values to the custom element:
(https://github.com/sveltejs/svelte/blob/master/src/runtime/internal/dom.ts#L315)
The function that is responsible always reads (
get
) the value from the custom element (via thetypeof
statement) before it sets the value, while preact-custom-element assumes that the value is set before it is read.Please let me know if my analysis makes sense and if you'd consider this something that should be fixed here or rather in the svelte implementation!
The text was updated successfully, but these errors were encountered: