fix(studio): restart action for table editor load errors FE-4054 - #48687
Conversation
…tor load errors Failed-to-load-tables errors that aren't connection timeouts had no troubleshooting steps at all, leaving no in-context way to restart the project. Add an ERROR_MAPPINGS entry for UnknownAPIResponseError that reuses the existing restart troubleshooting step.
The "Failed to load schemas" error only offered a retry, with no in-context way to restart the database when the underlying service is actually down. Add a "Restart database" button alongside it.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
5 Skipped Deployments
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughSchema-loading and table-loading errors now expose restart actions. ChangesRestart error handling
Estimated code review effort: 3 (Moderate) | ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 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 |
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
🎭 Playwright Test Results (tanstack)Details
Flaky testsFeatures › database.spec.ts › Database Functions › CRUD operations works as expected Skipped testsFeatures › auth-users.spec.ts › should show web3 users as enabled when the matching web3 provider is enabled |
…bars Reload schemas and Restart database sat in a fixed row and overflowed the table editor sidebar width.
…-in fallback The previous commit registered UnknownAPIResponseError in ERROR_MAPPINGS, but that breaks the classification system's contract that unclassified errors get no troubleshooting guide (locked in by ErrorMatcher.utils.test.ts). Add an explicit fallback prop to ErrorMatcher instead, used only by the table editor's load error, leaving the shared default behavior untouched.
There was a problem hiding this comment.
🧹 Nitpick comments (2)
apps/studio/components/ui/SchemaSelector.tsx (1)
69-69: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRename the restart-dialog boolean.
showRestartDialogis a boolean state, but its name does not start withis,has,can, orshould. Rename the state and setter, and update Lines 128-134.As per coding guidelines, boolean names in
apps/studio/**/*.{ts,tsx}must begin withis,has,can, orshould.Proposed rename
- const [showRestartDialog, setShowRestartDialog] = useState(false) + const [isRestartDialogVisible, setIsRestartDialogVisible] = useState(false) - onClick={() => setShowRestartDialog(true)} + onClick={() => setIsRestartDialogVisible(true)} - visible={showRestartDialog} - onClose={() => setShowRestartDialog(false)} + visible={isRestartDialogVisible} + onClose={() => setIsRestartDialogVisible(false)}Also applies to: 124-136
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/studio/components/ui/SchemaSelector.tsx` at line 69, Rename the boolean state `showRestartDialog` and its setter `setShowRestartDialog` in `SchemaSelector` to names beginning with an approved boolean prefix, such as `is`, and update all references in the restart-dialog logic around lines 124-136 to use the renamed symbols.Source: Coding guidelines
apps/studio/components/interfaces/ErrorHandling/ErrorMatcher.test.tsx (1)
49-53: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winExercise the restart action with the Studio test harness.
Use
customRenderon Line 51. After expandingTry restarting your project, assert theRestart projectcontrol or its confirmation dialog. The current assertion checks only the step title.As per coding guidelines, Studio tests must render components with
customRenderand useaddAPIMockfor any networked dependencies.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/studio/components/interfaces/ErrorHandling/ErrorMatcher.test.tsx` around lines 49 - 53, Update the unclassified API error test around ErrorMatcher to render with the Studio test harness customRender instead of render, then expand “Try restarting your project” and assert the resulting “Restart project” control or confirmation dialog. Use addAPIMock for any network request triggered by the restart interaction.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@apps/studio/components/interfaces/ErrorHandling/ErrorMatcher.test.tsx`:
- Around line 49-53: Update the unclassified API error test around ErrorMatcher
to render with the Studio test harness customRender instead of render, then
expand “Try restarting your project” and assert the resulting “Restart project”
control or confirmation dialog. Use addAPIMock for any network request triggered
by the restart interaction.
In `@apps/studio/components/ui/SchemaSelector.tsx`:
- Line 69: Rename the boolean state `showRestartDialog` and its setter
`setShowRestartDialog` in `SchemaSelector` to names beginning with an approved
boolean prefix, such as `is`, and update all references in the restart-dialog
logic around lines 124-136 to use the renamed symbols.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: ab61e35a-1173-4155-8249-5c591b555eaa
📒 Files selected for processing (6)
apps/studio/components/interfaces/ErrorHandling/ErrorMatcher.test.tsxapps/studio/components/interfaces/ErrorHandling/error-mappings.tsxapps/studio/components/interfaces/ErrorHandling/errorMappings/UnknownError.tsxapps/studio/components/ui/SchemaSelector.test.tsxapps/studio/components/ui/SchemaSelector.tsxapps/studio/types/api-errors.ts
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/studio/components/interfaces/ErrorHandling/ErrorMatcher.test.tsx`:
- Around line 70-76: Update both test cases in ErrorMatcher.test.tsx to use the
Studio test harness via customRender instead of render, and import the required
helper. Register any requests triggered by ErrorMatcher with addAPIMock so the
tests run through the repository’s MSW setup without unhandled-request failures.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 69733455-ce07-4eaf-8b2f-dc930e3b3174
📒 Files selected for processing (4)
apps/studio/components/interfaces/ErrorHandling/ErrorMatcher.test.tsxapps/studio/components/interfaces/ErrorHandling/ErrorMatcher.tsxapps/studio/components/interfaces/ErrorHandling/RestartTroubleshootingFallback.tsxapps/studio/components/layouts/TableEditorLayout/TableEditorMenu.tsx
…ntion showRestartDialog didn't follow the is/has/can/should convention for booleans in Studio.
Braintrust eval report
|
Problem
When the table editor showed a "Failed to load tables" or "Failed to load schemas" error (for example, when the underlying database or API gateway is unhealthy), there was no working way to restart the project from that error state. Restarting only worked by navigating to Project Settings.
Fix
"Failed to load tables" goes through the existing
ErrorMatcherclassification system, which only showed troubleshooting steps (including a restart action) for connection-timeout errors. Added anERROR_MAPPINGSentry for the unclassified/generic API error case, reusing the existingRestartDatabaseTroubleshootingSectionandRestartProjectDialogcomponents already used for connection timeouts."Failed to load schemas" (in the shared
SchemaSelector, used across the table editor and several Database pages) only offered a retry. Added a "Restart database" button next to it, wired to the sameRestartProjectDialog.How to test
apps/studio/components/interfaces/ErrorHandling/ErrorMatcher.test.tsxandapps/studio/components/ui/SchemaSelector.test.tsxcover both cases.FE-4054
Summary by CodeRabbit
New Features
Bug Fixes