Skip to content

Conversation

pranav200408
Copy link

@pranav200408 pranav200408 commented Sep 5, 2025

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 using component[STATE_SYMBOL] from the proxy, allowing it to be properly found in the mounted_components map.

Tests

  • Ran pnpm test and all tests passed.
  • Ran 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.

Copy link

changeset-bot bot commented Sep 5, 2025

⚠️ No Changeset found

Latest commit: 594d35e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@svelte-docs-bot
Copy link

Copy link
Contributor

github-actions bot commented Sep 5, 2025

Playground

pnpm add https://pkg.pr.new/svelte@16714

Copy link
Member

@dummdidumm dummdidumm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for starting the work on this, but

  • this needs a test (add one in runtime-runes) testing the fixed behavior
  • this needs to make sure it does not regress in other places (this will now fail if you didn't proxify the component instance with state)
  • this needs a change set (run pnpm changeset at the root and follow the prompts)

@Rich-Harris
Copy link
Member

closing in favour of #16747, there's just no reason to use $state here in the first place and thus no reason to accommodate it

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