Skip to content
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

Simple component-exists check to avoid throwing exceptions #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

banjerluke
Copy link

My Svelte-in-Blaze app was sometimes throwing errors in this part of SvelteComponent.js:

Template.SvelteComponent.onDestroyed(function onDestroyed() {
  this.component.$destroy();
});

My guess is that the template was getting destroyed before it had a chance to be rendered. I don't know why, but adding a check to see if this.component exists before calling .$destroy() seemed like an easy and pragmatic solution. Seems to be working well now with no side effects that I can detect.

@banjerluke
Copy link
Author

Side note to the maintainer(s): thank you so much for your work in making Svelte and Blaze work together. My app is pretty large now, and the thought of migrating the whole thing over to Svelte is basically unthinkable. But thanks to your packages, I was able to migrate just a few templates that need to be super-high-performance, and was able to throw away a ton of ugly raw-DOM kludges I was using with Blaze to get the necessary performance and ended up with something many times faster than what I started with. Kudos! 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant