Skip to content

Application state history#52

Draft
aidenybai wants to merge 4 commits into
mainfrom
cursor/application-state-history-2b6f
Draft

Application state history#52
aidenybai wants to merge 4 commits into
mainfrom
cursor/application-state-history-2b6f

Conversation

@aidenybai
Copy link
Copy Markdown
Owner

Implement a React time travel debugging module with a demo and comprehensive tests, enabling state history tracking and restoration using bippy.


Open in Cursor Open in Web

cursoragent and others added 2 commits January 29, 2026 18:56
- Add time-travel.ts that provides state history tracking using bippy
- Captures fiber state snapshots on each commit
- Allows navigation through state history with goBack/goForward
- Supports restoring to any previous snapshot via overrideHookState/overrideProps
- Provides APIs: createTimeTravel, createComponentTimeTravel, watchComponentState
- Add example usage in time-travel-example.tsx demonstrating the functionality

Co-authored-by: aiden <aiden@million.dev>
- Update App.tsx with TodoList component and TimeTravelSlider for testing
- Add time-travel.test.tsx with 8 tests verifying:
  - Snapshot capture on state changes
  - History tracking
  - Pause/resume recording
  - Clear history
  - Back/forward navigation
  - Go to specific snapshot
  - watchComponentState functionality
- Add vitest config and testing dependencies to vite-playground
- All tests pass (88 total across bippy and vite-playground)

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

cursor Bot commented Jan 29, 2026

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

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jan 29, 2026

⚠️ No Changeset found

Latest commit: cfe77aa

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

@vercel
Copy link
Copy Markdown

vercel Bot commented Jan 29, 2026

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:16pm

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Jan 29, 2026

Open in StackBlitz

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

commit: cfe77aa

This adds a more robust alternative to the fiber-based time travel:

- time-travel-robust.ts: Centralized store with action replay
  - createTimeTravelStore: Redux-like store with built-in time travel
  - useTimeTravelStore: Hook to subscribe to store state
  - useTimeTravelControls: Hook for navigation controls
  - useUndoable: Simple undo/redo hook for local state
  - createReducer: Helper to create reducers from handlers
  - Middleware support (logger, Redux DevTools)
  - Persistence support via localStorage

- time-travel-robust-demo.tsx: Demo comparing both approaches
  - Todo list with full time travel controls
  - Undo/redo counter example
  - Comparison of advantages vs trade-offs

- time-travel-robust.test.tsx: 19 comprehensive tests

Advantages over fiber-based approach:
- No reliance on React internals
- Works in production builds
- Predictable state transitions via reducer
- Action replay for debugging
- Redux DevTools integration
- Serializable/persistable state
- Type-safe with TypeScript

Co-authored-by: aiden <aiden@million.dev>
- Replace fiber-based time travel with robust store-based solution
- TodoList now uses createTimeTravelStore with reducer
- Actions: ADD_TODO, TOGGLE_TODO, DELETE_TODO
- TimeTravelSlider shows action history with payloads
- Supports: slider navigation, replay, reset, jump to start/end

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