-
Notifications
You must be signed in to change notification settings - Fork 332
Add time machine plugin: record state history and travel back/forward in time #519
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
aidenybai
wants to merge
6
commits into
main
Choose a base branch
from
aiden/time-machine-plugin-5fda
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
4e7323b
Add time machine plugin: record state history and travel back/forward…
cursoragent 60309e6
Support useReducer time travel and document useSyncExternalStore excl…
cursoragent 80384e7
Re-freeze time on reopen while rewound, preserve timer this-binding, …
cursoragent ab2168f
Route native timer bypass through pre-wrapper functions captured at i…
cursoragent 4716cb5
fix(openstory): pre-compile *.react.tsx JSX with React runtime
cursoragent 1f38fe9
Record render cost + long animation frames per entry, add Live pill t…
cursoragent File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "react-grab": patch | ||
| --- | ||
|
|
||
| Add a time machine plugin that records every React state change (via bippy commit instrumentation) and lets you scrub backward and forward through that history. A new toolbar button (clock icon) opens a mini scrubber panel directly — no element selection required, and the app stays live so new changes keep appending to the timeline — while a built-in "Time Machine" context-menu action (shortcut H) opens it scoped to a selected element with the page frozen. The panel reuses the style panel's slider-with-step-arrows control: ←/→ (or dragging the track) travels the app one recorded change at a time. Travel restores exact hook values — useState through each hook's own dispatcher, useReducer by writing the hook state directly on both fiber buffers and forcing a bailout-defeating re-render (useSyncExternalStore is deliberately excluded: external stores cannot be written back). Making a new change while rewound forks the timeline like undo/redo. Rewinding also stops the page's clock entirely: CSS/WAAPI animations pause (loops seek to where they were at the rewound moment; finite transitions hold their settled pose instead of replaying), and the page's own scheduling — requestAnimationFrame loops, setTimeout chains, setInterval tickers — is suspended so JS-driven animation engines hold still too, with parked callbacks replayed when time resumes. Animation-tick state bursts (text scrambles, count-ups) coalesce into single timeline entries so scrubbing lands only on settled moments, never garbled mid-animation frames, while commits near real pointer/keyboard input always stay distinct steps. Interaction visuals travel too — each entry records the hover/focus/active styling active at that moment, and rewinding pins it back on (purely visually; focus never actually moves). Works against production React builds too (useState hooks are detected by probing the reducer's behavior since prod minifies `basicStateReducer`'s name). The plugin is exported as `timeMachinePlugin` for standalone use. |
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.