Repository navigation
feat: show changed fields instead of full snapshots in devtools state history - #31
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
State Historyin the inspector State panel rendered the full state snapshot for every entry, which became an unreadable wall of JSON for composables with large or frequently-changing state, and gave no indication of what actually changed between two adjacent entries.diffSnapshotValues, which recursively compares a snapshot against the previous (older) one and returns a flat map ofpath: "from → to"strings for every leaf value that changed (e.g.user.profile.name: "a → b"). Nested objects are drilled into so only the actually-changed leaf is reported — not the whole containing object — keeping diffs readable even for deeply nested state. Arrays are compared and reported as whole values rather than recursed into by index.Stateitself is displayed, with no extra wrapper objects to expand.Closes #25
Test plan
pnpm vitest run packages/pluginpasses (added unit tests fordiffSnapshotValues, including nested-object and array cases)pnpm lintpasses