fix: auto-switch to ERD tab on realtime schema update#3978
Conversation
Fix the issue where ERD tab doesn't automatically switch when a new schema version is created via realtime update. Root causes: 1. Duplicate state update: handleChangeSelectedVersion was calling setSelectedVersion, but it's already called in useRealtimeVersionsWithSchema 2. Missing effect dependency: Without a useEffect tracking versions and selectedVersion, React's rendering cycle wasn't properly triggered Changes: - Remove setSelectedVersion call from handleChangeSelectedVersion - Add empty useEffect with [versions, selectedVersion] dependencies to ensure proper state synchronization Resolves: #5940 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
Finished running flow.
|
||||||||||||
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
|
Updates to Preview Branch (fix-erd-tab-switch) ↗︎
Tasks are run on every commit but only new migration files are pushed.
View logs for this Workflow Run ↗︎. |
WalkthroughA callback function Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (4)**/*.tsx📄 CodeRabbit inference engine (AGENTS.md)
Files:
**/*.{ts,tsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
frontend/apps/**📄 CodeRabbit inference engine (AGENTS.md)
Files:
frontend/**/*.{ts,tsx}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
🧬 Code graph analysis (1)frontend/apps/app/components/SessionDetailPage/SessionDetailPageClient.tsx (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
🔇 Additional comments (2)
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 |
Check changeset necessityStatus: NOT REQUIRED Reason:
Changeset (copy & paste):# Not required — changes are in ignored package(s); do not create a changeset. |
Summary
Fixes #5940
Fix the issue where ERD tab doesn't automatically switch when a new schema version is created via realtime update.
Root Causes
handleChangeSelectedVersionwas callingsetSelectedVersion, but it's already called inuseRealtimeVersionsWithSchemaversionsandselectedVersion, React's rendering cycle wasn't properly triggeredChanges
setSelectedVersioncall fromhandleChangeSelectedVersion(frontend/apps/app/components/SessionDetailPage/SessionDetailPageClient.tsx:76-78)[versions, selectedVersion]dependencies to ensure proper state synchronizationTechnical Details
During debugging, we discovered that:
console.log, but the useEffect's dependency arrayTest Plan
🤖 Generated with Claude Code
Summary by CodeRabbit