Repository navigation
website: Reset playground previews after edit-caused errors - #4255
Conversation
An edit can leave store data unreadable by the new code (e.g. changing Entity.key). After such a render error the preview now retries once with a fresh store, restoring the old one if the error persists. Render errors also get a Reset preview button, and the Live Preview header has a reset icon. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XvW9Gn7xGDsdcB7de2HX8a
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4255 +/- ##
==========================================
+ Coverage 98.10% 98.14% +0.04%
==========================================
Files 166 169 +3
Lines 3166 3236 +70
Branches 626 641 +15
==========================================
+ Hits 3106 3176 +70
Misses 18 18
Partials 42 42 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Read render-vs-compile errors from react-live's newCode, pass the store snapshot from PreviewError instead of a controller ref, and reuse the preview's base button skin and clean-btn. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XvW9Gn7xGDsdcB7de2HX8a
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XvW9Gn7xGDsdcB7de2HX8a
|
Staff engineer (Cursor agent): Reviewed at 139eecb. Remounting with a fresh store (rather than CHANGE_THIS_PR:
That contradicts the stated rule ("neither do errors in code the store was created with"; only errors that follow an edit should retry). Smallest fix: have I tried to break this fix: the FOLLOW_UP (after merge, no change needed now)
|
|
Staff engineer (Cursor agent): LGTM at 348af31. Remounting through the
|
Track the code a preview store last rendered cleanly under, so a later error in that same code (an interaction, a poll) never wipes the store. Test PreviewError against a real LiveProvider to guard its use of react-live's newCode. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XvW9Gn7xGDsdcB7de2HX8a
|
Thanks, all three addressed in ba42041:
Generated by Claude Code |
|
Following up on the 348af31 review:
Generated by Claude Code |
|
Lead Engineer: @Staff, please re-review ba42041, which addresses your CHANGE_THIS_PR from 139eecb (issuecomment-6029851654). Why: What I checked at ba42041:
Non-blocking, for your judgment: |
|
Staff engineer (Cursor agent): LGTM at ba42041.
Follow-up (fine after merge): when a fresh-store trial goes healthy, |
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XvW9Gn7xGDsdcB7de2HX8a
|
The v3 case is real and is a regression from ba42041. A clean render of different code now drops Generated by Claude Code |
|
Lead Engineer: @Staff, please re-review 75c619b. It's a source change on top of ba42041, which you approved, so that approval no longer covers the tip. Why: your post-merge follow-up pointed out that What I checked at 75c619b:
Non-blocking: the 1s healthy timer also fires while v3 is suspended, so a slow first fetch after the edit to v3 drops |
|
Staff engineer (Cursor agent): Re-reviewed 75c619b. Still LGTM, follow-up only (not blocking). The new Trace: Once the trial has rendered cleanly, the old store has nothing left to offer. A later error belongs to the fresh store, the same reasoning as Fine to fold into this PR or do after merge. |
|
I'm keeping the same-code case as is. The premise that the "fresh store errors too" error "arrives before the 1s healthy timer" holds only for fast fetches. The timer also runs while the trial is suspended on Loading, and the homepage demo fetches jsonplaceholder over the real network. Here's what would happen with this change and a typo like Without the change, the worst case is a poll error after a successful trial. That brings back the old store, the preview shows the error, and Reset preview is right there, so nothing is lost. I'd rather keep the failure mode that loses no state. If we add a real "rendered data, not a fallback" signal later, both cases can be handled properly. Generated by Claude Code |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 139eecbdb3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
… optimistic updates Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XvW9Gn7xGDsdcB7de2HX8a
|
Lead Engineer: @Staff, please re-review 34cbf66. It's a source change on top of 75c619b, which you approved, so that approval no longer covers the tip. Why: when a fresh-store retry fails and the old store is restored, only the What I checked at 34cbf66:
Non-blocking notes:
|
|
Staff engineer (Cursor agent): Still LGTM at 34cbf66, follow-up only. The new commit is the right call. Restoring the store without the simulated server's data would bring back entities the fixtures no longer agree with, so carrying Follow-up (non-blocking): My earlier follow-up is still open: when the fresh-store trial renders cleanly on the same code, |
…t in CI CI drops the website workspace, so PreviewError.test could not resolve react-live. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XvW9Gn7xGDsdcB7de2HX8a
|
Lead Engineer: @Staff, please re-review bf0260d. You approved 34cbf66, and this commit sits on top of it, so that approval doesn't cover the tip. Why: CI keeps only What I checked:
Non-blocking: this also helps with your react-live follow-up. Since the test now imports react-live from the root, a react-live bump will exercise the |
…eps fixture data Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XvW9Gn7xGDsdcB7de2HX8a
|
Replies to the 34cbf66 notes:
Generated by Claude Code |
|
Lead Engineer: Staff, please re-review a02a31b instead of bf0260d. What changed: a02a31b ("Test the playground snapshot drops optimistic updates and keeps fixture data") only touches Why it matters: this pins down the 34cbf66 behavior (a restore brings back MockResolver's interceptor data along with the store, and drops pending optimistic updates because in-flight requests die with the old store) through the real react-live path, so it also partly covers the FOLLOW_UP about relying on Findings: no source change, so the Non-blocking: GitHub currently reports this branch as not mergeable (conflicts with |
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XvW9Gn7xGDsdcB7de2HX8a
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Lead Engineer: @Staff, please re-review Why: your last look was at What I checked:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a02a31b091
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…rror card Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XvW9Gn7xGDsdcB7de2HX8a
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Lead Engineer: @Staff, please re-review What changed: What I checked:
Non-blocking notes:
|
…r card Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XvW9Gn7xGDsdcB7de2HX8a
Generated by Claude Code |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Lead Engineer: @Staff, please re-review What changed: What I checked:
Claude chose to leave note 2 (a top-level runtime |
Moves ErrorPanel into its own module with one table of labels and icons, classifies errors from the parsed name, and gives the network fallback a stable component so its card isn't remounted on every parent render. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XvW9Gn7xGDsdcB7de2HX8a
|
Lead Engineer: Claude pushed 65644ef ("Simplify the playground error card") on top of e2d926e. @Staff, please re-review 65644ef. Why I'm flagging it: this is a cleanup pass on the error card. It doesn't touch the store-reset logic you asked to change, but it does change how the network error boundary resets, so it's worth a look. What I checked in the diff (e2d926e...65644ef):
CI on 65644ef was still running when I checked ( |
…ws and header reset Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XvW9Gn7xGDsdcB7de2HX8a
|
Lead Engineer: @Staff, please re-review What changed: What I checked in the diff (
The follow-ups from your review (a real- |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 78ad1c8553
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Requested by Nathaniel · project thread
Motivation
Before: editing a playground (for example, adding
static key = 'Post5'toPostin the homepage demo) left the old store data in place. The preview then broke withTypeError: Cannot read properties of undefined (reading 'map')until the page was reloaded. There was no way to reset a preview, and every error looked the same as raw red text.After: the preview recovers on its own, render errors offer a Reset preview button, and the Live Preview header has a reset icon. Errors now show in a card that says which stage failed: an amber Compile error when the code never ran, and a red Runtime error when it threw.
Solution
usePreviewReset): when a render error follows an edit, the preview retries once with a fresh store. If the error persists, the store wasn't the cause, so the old store comes back and no state is lost. It won't retry again until the preview has rendered cleanly for a second, so typing through a typo costs at most one retry. Compile and evaluation errors never reset, and neither do errors in code the store was created with.@media (hover: hover).ErrorPanel): a kind label and icon, the error name in bold, and sucrase's(line:col)muted. It is used for compile, runtime and network (ResetableErrorBoundary) errors, and it is themed for light and dark mode and wraps on mobile.Verified on the dev site with Playwright:
Entity.keyedit now renders.posts.mapptypo streak triggers one retry, then restores the old store with no refetch.🤖 Generated with Claude Code
https://claude.ai/code/session_01XvW9Gn7xGDsdcB7de2HX8a
Generated by Claude Code
Note
Low Risk
Changes are scoped to website playground preview UX and docs tests; no production library or auth/data-path changes.
Overview
Adds preview reset and structured error UI for doc site live playgrounds so edit-induced store corruption can recover without a full page reload.
usePreviewResetremounts the react-live preview (newDataProviderkey) on manual reset (header icon or Reset preview on render failures). After a clean render, if a render error follows a code edit, it retries once with a fresh store; if the error persists it restores the prior store snapshot (state + mock interceptor data). Retries are gated (healthy for ~1s, no auto-retry for compile/eval errors or code that already rendered cleanly). User interaction in the preview commits to the fresh store.ErrorPanelreplaces rawLiveError/ plain network text: amber Compile error, red Runtime error, and Network error inResetableErrorBoundary, with themed cards and optional actions.PreviewErrorclassifies react-live failures vianewCodevscodeand snapshots the controller on render errors.Adds root
react-livedevDependency for Jest coverage ofPreviewError/ reset behavior; README documents the new invariants.Reviewed by Cursor Bugbot for commit 78ad1c8. Bugbot is set up for automated code reviews on this repo. Configure here.