Skip to content

feat: show changed fields instead of full snapshots in devtools state history - #31

Merged
anton-gor-dev merged 2 commits into
mainfrom
feat/devtools-state-history-diff
Jun 7, 2026
Merged

anton-gor-dev merged 2 commits into
mainfrom
feat/devtools-state-history-diff

Conversation

@anton-gor-dev

@anton-gor-dev anton-gor-dev commented Jun 7, 2026 •

Copy link
Copy Markdown
Member

Summary

  • State History in 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.
  • Added diffSnapshotValues, which recursively compares a snapshot against the previous (older) one and returns a flat map of path: "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.
  • Each history entry's value is now this flat diff map directly — one level of nesting (entry → changed field), matching how State itself is displayed, with no extra wrapper objects to expand.

Closes #25

Test plan

  • pnpm vitest run packages/plugin passes (added unit tests for diffSnapshotValues, including nested-object and array cases)
  • pnpm lint passes

@anton-gor-dev
anton-gor-dev merged commit 7ed8b3f into main Jun 7, 2026
1 check passed
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.

DevTools: show diffs instead of full snapshots in State History

1 participant