Skip to content

React state time travel - #53

Draft
aidenybai wants to merge 2 commits into
mainfrom
cursor/react-state-time-travel-d038
Draft

React state time travel#53
aidenybai wants to merge 2 commits into
mainfrom
cursor/react-state-time-travel-d038

Conversation

@aidenybai

Copy link
Copy Markdown
Owner

Adds a React state time-travel debugging module to bippy, enabling tracking and restoration of component state and props history.


Open in Cursor Open in Web

- Add TimeTravel class that tracks state/props history on every commit
- Implement history navigation (goBack, goForward, goToIndex, goToCommitId)
- Support state restoration via overrideHookState and overrideProps
- Add component filtering by name or custom function
- Implement diff functionality to compare snapshots
- Add state/props timeline methods for individual fibers
- Support export/import of history as JSON
- Add comprehensive test coverage for all features

The time-travel module uses bippy's instrumentation to:
1. Capture snapshots of fiber state on every commit
2. Store props and hook states with proper cloning
3. Restore previous states using React DevTools-style overrides

Co-authored-by: aiden <aiden@million.dev>
@cursor

cursor Bot commented Jan 29, 2026

Copy link
Copy Markdown

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@vercel

vercel Bot commented Jan 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
bippy Ready Ready Preview, Comment Jan 29, 2026 7:37pm

@changeset-bot

changeset-bot Bot commented Jan 29, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 2c29408

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Jan 29, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/bippy@53

commit: 2c29408

Improvements:
- Proper hook type identification (State, Reducer, Ref, Effect, Memo, etc.)
- Track which hooks are actually editable (only State and Reducer)
- Use WeakRef for fiber references to handle double-buffering
- Add class component state tracking support
- Add external state manager integration hooks (captureExternalState, restoreExternalState)
- Add onBeforeRestore callback for restore cancellation
- Add fibersByName index for faster component lookups
- Better error handling during restoration
- Skip non-serializable props (functions, key, ref, children)
- Use getLatestFiber to handle fiber alternates correctly
- Add utility methods: getTrackedFiberIds, getTrackedComponentNames, getEditableStateCount
- Include hookType in diff results and state timeline
- Export/import now includes version and external state

Test improvements:
- Add hook type identification tests
- Add external state capture/restore tests
- Add onBeforeRestore callback tests
- Add utility method tests
- Fix test cleanup between runs

Co-authored-by: aiden <aiden@million.dev>
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.

2 participants