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

[fix] runtime: destroy missing fragment #6996

Conversation

TorstenDittmann
Copy link
Contributor

@TorstenDittmann TorstenDittmann commented Dec 6, 2021

Before submitting the PR, please make sure you do the following

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • Prefix your PR title with [feat], [fix], [chore], or [docs].
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests

  • Run the tests with npm test and lint the project with npm run lint

Problem

When manually removing a HTML element from a component, it is trying to be accessed later on in the destroy lifecycle where it throws an error.

This PR adds optional chaining before accessing removeChild from the parentNode property to prevent the error thrown.

I prepared a REPL where this fails => https://svelte.dev/repl/0d826c0d67c54d8693aeaa1b77ea09ef?version=3.44.2

@TorstenDittmann TorstenDittmann changed the title fix(runtime): destroy missing fragment [fix] runtime: destroy missing fragment Dec 7, 2021
@Conduitry
Copy link
Member

There's (at least) one other PR for this already (#6910) but I'm not convinced this is something that we want to do.

@Conduitry Conduitry closed this Dec 7, 2021
@martinmogusu
Copy link

martinmogusu commented Aug 13, 2022

There's (at least) one other PR for this already (#6910) but I'm not convinced this is something that we want to do.

@Conduitry why would this not be a desirable change in your opinion? What is your suggested workaround?

I encountered a similar issue when trying to use the list.js package in Svelte. The package usually removes some nodes when filtering/searching and Svelte is not aware of the changes

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.

3 participants