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

handle set after destroy, and move destroy into shared helpers #755

Merged
merged 5 commits into from
Aug 9, 2017

Conversation

Rich-Harris
Copy link
Member

Fixes #744, by checking for this._destroyed before calling set. Though now that I think about it, replacing the set method with noop might be better... will make that change in a sec.

Anyway, I also moved the destroy method into the shared helpers. The only bit of component-specific stuff in the destroy method relates to the ondestroy lifecycle hook, and that can be dealt with as an event handler. Should shave a few bytes off apps with multiple components.

@Conduitry
Copy link
Member

Might we also want to replace destroy with noop`? You could still get the dev warning by also doing

export function destroyDev(detach) {
	destroy.call(this, detach);
	this.destroy = () => console.warn('Component was already destroyed');
}

@Rich-Harris
Copy link
Member Author

That's brilliant! Now we don't even need to keep track of this._destroyed.

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.

2 participants