svelte icon indicating copy to clipboard operation
svelte copied to clipboard

[fix] check for parent_component before accessing root

Open hgiesel opened this issue 2 years ago • 4 comments

Fixes #6584.

Tests

No tests

hgiesel avatar Aug 13 '21 19:08 hgiesel

Hello any update on this ? It would fix many problems. Thanks

samedro avatar Oct 21 '21 07:10 samedro

Does defining document as fallback really work as expected? To me it seems a bit suspicious.

atomcat1978 avatar Jul 20 '22 02:07 atomcat1978

Hello, I have the same issue on my side with the latest version.

In fact, if we check the parent_component value it's works. But if we set the value as a document we need to refactor the append_styles function behind which is return undefined (and crash) if the root are document

Tlahey avatar Jul 27 '22 11:07 Tlahey

Actually, in my case the reason of the problem was that svelte was included in a component library project. This led to various bugs, being one of them this undefined parent_component. I wonder, that possibly different/multiple svelte versions in the application and the used svelte component (npm package) might be the real reason of such issues.

atomcat1978 avatar Jul 27 '22 21:07 atomcat1978

Thanks for the PR, but this isn't a real fix for the underlying problem, which is that people are using different compiled versions of Svelte mixed up in the same project. This fix might solve the undefined issue, but other subtle bugs due to different compiler versions may occur. More info here: https://github.com/sveltejs/svelte/issues/6584#issuecomment-1019578529

dummdidumm avatar Feb 23 '23 11:02 dummdidumm