-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
feat: add $inspect.trace rune #14290
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: fa941f7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
|
WIP WIP WIP WIP WIP WIP WIP WIP WIP WIP WIP WIP WIP WIP WIP WIP WIP WIP WIP WIP
preview: https://svelte-dev-git-preview-svelte-14290-svelte.vercel.app/ this is an automated message |
This PR has compiled to that output for a while now. Worth checking it out again sometime :)
It wouldn't make anything simpler with the new design. |
Co-authored-by: Rich Harris <rich.harris@vercel.com>
Co-authored-by: Rich Harris <rich.harris@vercel.com>
Co-authored-by: Rich Harris <rich.harris@vercel.com>
Co-authored-by: Rich Harris <rich.harris@vercel.com>
@Rich-Harris Feel free to apply your local changes to this PR if that's easier. |
packages/svelte/src/compiler/phases/2-analyze/visitors/CallExpression.js
Outdated
Show resolved
Hide resolved
packages/svelte/src/compiler/phases/2-analyze/visitors/CallExpression.js
Outdated
Show resolved
Hide resolved
packages/svelte/src/compiler/phases/2-analyze/visitors/CallExpression.js
Outdated
Show resolved
Hide resolved
packages/svelte/src/compiler/phases/2-analyze/visitors/CallExpression.js
Outdated
Show resolved
Hide resolved
The 'you can put this anywhere in a Similarly if I have a trace inside a block inside a function, everything below the block is ignored because of the early return. (The messaging if the function is called outside an effect is also a little confusing — it says there are no reactive dependencies but I can see them! Not sure how best to resolve.) So I think the placement rule should be that If we do that, I'd love it if we can get rid of the label argument, or at least make it optional — we can just use the function name, or Also: why is this showing no reactive dependencies inside the effect? |
I agree, I've changed it so it has to be in a function. I didn't want to limit it to be the first entry as that can cause issues inside class constructors etc.
It literally used to do exactly this, but I found it was just not useful at all. You mostly put it in effects, so it would just log
Odd, it works for me locally, but not on the REPL?! |
Can you elaborate? It should be fine as long as you're not using |
They can't even use |
Closes #14265. This adds the
$inspect.trace
rune to Svelte which logs the reactive graph of the current reactive context. It must be placed in a block statement and requires a string passed as an argument which is the trace name.