-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
fix: better $inspect.trace()
output
#16131
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
Conversation
…t just makes things inconsistent with deriveds. personally i find it more confusing anyway
🦋 Changeset detectedLatest commit: 281b972 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 |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The debug field is necessary in each block cases like this:
- prod shows the correct stack back to the source
- this PR ends up in generated code, making the stack useless
It's because the each block creates signals for each array entry if it needs to.
Somehow it gets weirder when using $state
as now every part of the entry is logged for some reason
This reverts commit a95b625.
alright, that should be fixed now |
While reviewing #16060 I took a closer look at the
$inspect.trace()
code and found some odd stuff plus a few bugs. This PR tidies things up a bit:if (/* impossible condition */)
block, which is now removed (even if the removed block did do what it purported to, I don't think it would be desirable)each
blocks. I couldn't for the life of me figure out how to make this do anything useful, and no tests failed when I removed it. 🎵 If you like it then you shoulda put a test on it 🎵TracedAt
stacks, which can happen when e.g. using$state.snapshot
(which enumerates properties and then reads them, both of which cause a stack to be added)UpdatedAt
stacks for dirty signals. it's weird to include this for things that haven't changedtrace
#14811 it prints the value at the start of the effect but that makes no sense to me at all — in the test case from that PR it misleadingly appears that the value ofcount
changed from start to end during the effect's final run, and if you add a derived, the logged values are inconsistent. It's simpler, both from the user's perspective and in terms of implementation, to just always show the latest valueThere's probably more that can be done to improve this stuff — for example I think we should show updated signals first, and relegate unchanged ones to the bottom, and the 'version' signals could probably have a clearer label. But I thought that could wait for a follow-up
Before submitting the PR, please make sure you do the following
feat:
,fix:
,chore:
, ordocs:
.packages/svelte/src
, add a changeset (npx changeset
).Tests and linting
pnpm test
and lint the project withpnpm lint