Keep Charts preview history in sync - #1179
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughPreview browser-state handlers now compute history from the current ref, update the ref immediately, and pass the same snapshot to React state. Existing URL normalization, navigation-error clearing, and annotation-target reset behavior remain intact. ChangesPreview history synchronization
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to The change keeps preview navigation history synchronized across the affected Charts surfaces without changing the existing behavior contract. No actionable merge-blocking risk remains beyond normal checks and review. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
tanstack-com | 302e8e3 | Commit Preview URL Branch Preview URL |
Aug 25 2026, 02:11 PM |
Evidence
Both Charts preview message handlers read
previewHistoryRef.current, but updated that ref inside a React state updater. State updaters can be evaluated after the message handler returns, so a second browser-state message can read stale history and calculate navigation or annotation state from the wrong URL. The notebook instance was also left as an unresolved review finding on merged PR #1171.The same pattern exists in the catalog result handler. No open issue or PR addresses the synchronization bug. PR #1173 touches the catalog result only to remove an unused callback, not preview history behavior.
Impact
Rapid preview navigation messages now build on the latest accepted history in both Charts surfaces. This prevents stale back/forward entries and annotation targets.
Change
Compute the next history from the current ref, update the ref synchronously, then pass that exact value to React state. This keeps the existing history helper and behavior, with no new abstraction or API change.
Validation
pnpm testgit diff --checkRisk
Low. The same pure
updateExamplePreviewHistoryresult still drives state, but the mutable ref now advances in the message handler before another message can arrive.Summary by CodeRabbit