Application state history#52
Draft
aidenybai wants to merge 4 commits into
Draft
Conversation
- 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 Agent can help with this pull request. Just |
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
commit: |
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>
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.
Implement a React time travel debugging module with a demo and comprehensive tests, enabling state history tracking and restoration using bippy.