fix: Use STATE_SYMBOL to de-proxy component in unmount (#16656) #16714
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
loses #16656
Description
This PR addresses a bug where calling the
unmount
method on a component instance created with$state
would fail due to the instance being a proxy.Fix
The
unmount
method now correctly retrieves the component's raw instance usingcomponent[STATE_SYMBOL]
from the proxy, allowing it to be properly found in themounted_components
map.Tests
pnpm test
and all tests passed.pnpm lint
and all lint checks passed.Additional Information
This change implements the solution suggested by maintainers in the issue thread, ensuring a correct fix that aligns with Svelte's internal design.