-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot read property 'c' of undefined if component is unloaded / conditionally rendered #2
Comments
Thanks for reporting! I can indeed reproduce this with a simple conditional rendering, the application throws an exception when the conditional is changed to false and the component is unmounted. I have no idea yet why it happens. Help would be welcome to figure this out! |
I wish I could offer more insight here, I think this issue might be related. The stack I see in the error looks really similar to the one in that issue. Looks like there are a variety of suggestions there, I'll try some myself since it looks like some are for consuming a library that has the issue rather than fixing it. It is mentioned a few times in the issue that they think the problem might be multiple svelte versions. I'll see if either the "dedupe" or code patch solutions work in this case. |
Thanks! |
I've spend some time trying to figure this out. It turns out, the current recommended way to publish Svelte components is to publish the source code, see https://github.com/sveltejs/component-template#consuming-components:
Problem with this approach is that any preprocessing required by components must be taken care of by the consuming application. In this case: SASS preprocessing and JSON loading. I've described how to do this for Ideally, the consumer of a component doesn't have to worry about any preprocessing required by the components it uses. This is discussed here: sveltejs/component-template#8, but here is no solution yet as far as I can see. |
I thought maybe this was related to the svelte router library I chose at first, but then I reproduced the issue with this minimal component:
This issue can also be reproduced if you have the json editor component loaded in a component that is loaded / unloaded by the "svelte-routing" package.
The text was updated successfully, but these errors were encountered: