Skip to content

feat: add source name logging to $inspect.trace #16060

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

Open
wants to merge 31 commits into
base: main
Choose a base branch
from

Conversation

Ocean-OS
Copy link
Contributor

@Ocean-OS Ocean-OS commented Jun 2, 2025

This adds name logging to $inspect.trace. Currently, $inspect.trace logs the type of dependency ($state or $derived), its current value, and a few stack traces related to it. In this PR, to better understand your dependencies, it includes the name of each dependency— if it's a variable, it'll log its name, and if it's an object property, it'll log the path (eg object.foo.bar.baz[0]).

Probably closes #15954

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 Jun 2, 2025

🦋 Changeset detected

Latest commit: 0901a1b

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

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

github-actions bot commented Jun 2, 2025

Playground

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

@Rich-Harris
Copy link
Member

What does PROXY_REMOVE_PATH do? No tests fail if I remove it altogether

@Ocean-OS
Copy link
Contributor Author

Ocean-OS commented Jun 2, 2025

It does the [$state proxy] tag when a proxy is shared by two sources

@Ocean-OS
Copy link
Contributor Author

Ocean-OS commented Jun 2, 2025

I don't think there's any tests for that yet

@Ocean-OS
Copy link
Contributor Author

Ocean-OS commented Jun 2, 2025

Also, is there any reason you removed the proxy version source tag?

@Rich-Harris
Copy link
Member

No, just commented it out to understand better, but then forgot to uncomment

@Ocean-OS
Copy link
Contributor Author

Ocean-OS commented Jun 4, 2025

I just realized we should probably tag the sources used in svelte/reactivity
I'll do that later today

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.

Confusing output by $inspect.trace
2 participants