Skip to content

fix: don't clone non-proxies in $inspect #16617

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

Merged
merged 3 commits into from
Aug 14, 2025
Merged

fix: don't clone non-proxies in $inspect #16617

merged 3 commits into from
Aug 14, 2025

Conversation

Ocean-OS
Copy link
Member

Closes #16616.

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.
  • If this PR changes code within packages/svelte/src, add a changeset (npx changeset).

Tests and linting

  • Run the tests with pnpm test and lint the project with pnpm lint

Copy link

changeset-bot bot commented Aug 14, 2025

🦋 Changeset detected

Latest commit: 485a1af

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
svelte Patch

Not sure what this means? Click here to learn what changesets are.

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

Copy link
Contributor

Playground

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

@Rich-Harris
Copy link
Member

Looks like some tests will need to be updated.

I actually think it's quite useful that objects are cloned inside $inspect where possible — it's easier to understand how something changed over time that way. What if we just didn't call toJSON on these objects?

@Ocean-OS
Copy link
Member Author

Ocean-OS commented Aug 14, 2025

Wouldn't structuredCloneing them call toJSON though?

@Ocean-OS
Copy link
Member Author

ah wait nevermind

Copy link
Member

@Rich-Harris Rich-Harris left a comment

Choose a reason for hiding this comment

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

yeah, this seems like a good change 🙌

@Ocean-OS Ocean-OS merged commit ad19a1a into main Aug 14, 2025
16 checks passed
@Ocean-OS Ocean-OS deleted the gh-16616 branch August 14, 2025 19:51
@github-actions github-actions bot mentioned this pull request Aug 11, 2025
@7nik
Copy link
Contributor

7nik commented Aug 14, 2025

Do I miss something or no_tojson is never set to true?

@Ocean-OS
Copy link
Member Author

ah shoot, forgot to un-revert the change here.

Ocean-OS added a commit that referenced this pull request Aug 14, 2025
* quick fix

* fix failing test
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.

$inspect and $state.snapshot call toJSON method on Three.js objects
3 participants