Skip to content

fix(studio): restart action for table editor load errors FE-4054 - #48687

Merged
jordienr merged 5 commits into
masterfrom
jordi/fe-4054-restart-button-load-errors
Aug 4, 2026
Merged

fix(studio): restart action for table editor load errors FE-4054#48687
jordienr merged 5 commits into
masterfrom
jordi/fe-4054-restart-button-load-errors

Conversation

@jordienr

@jordienr jordienr commented Aug 4, 2026

Copy link
Copy Markdown
Member

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 ErrorMatcher classification system, which only showed troubleshooting steps (including a restart action) for connection-timeout errors. Added an ERROR_MAPPINGS entry for the unclassified/generic API error case, reusing the existing RestartDatabaseTroubleshootingSection and RestartProjectDialog components 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 same RestartProjectDialog.

How to test

  • In the table editor, trigger a table-load failure that isn't a connection timeout (any generic API error). The error card should now show a "Try restarting your project" step with a working restart action.
  • Open the schema selector while schemas fail to load (e.g. mock a 503 from the schemas query). A "Restart database" button should appear next to "Reload schemas" and open the restart confirmation dialog.
  • apps/studio/components/interfaces/ErrorHandling/ErrorMatcher.test.tsx and apps/studio/components/ui/SchemaSelector.test.tsx cover both cases.

FE-4054

Summary by CodeRabbit

  • New Features

    • Added database restart guidance when schema loading fails.
    • Added options to reload schemas or restart the database, including a confirmation prompt.
    • Added troubleshooting guidance for unclassified table-loading errors.
  • Bug Fixes

    • Improved error handling by displaying relevant fallback guidance for unknown errors while preserving classified troubleshooting instructions.

…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.
@vercel

vercel Bot commented Aug 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
studio-self-hosted Ready Ready Preview Aug 4, 2026 10:52am
studio-staging Ready Ready Preview Aug 4, 2026 10:52am
5 Skipped Deployments
Project Deployment Actions Updated (UTC)
studio Ignored Ignored Aug 4, 2026 10:52am
design-system Skipped Skipped Aug 4, 2026 10:52am
docs Skipped Skipped Aug 4, 2026 10:52am
ui-library Skipped Skipped Aug 4, 2026 10:52am
zone-www-dot-com Skipped Skipped Aug 4, 2026 10:52am

Request Review

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 0bc62719-3315-452a-91fa-54a892896470

📥 Commits

Reviewing files that changed from the base of the PR and between 42385c7 and e03094c.

📒 Files selected for processing (1)
  • apps/studio/components/ui/SchemaSelector.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/studio/components/ui/SchemaSelector.tsx

📝 Walkthrough

Walkthrough

Schema-loading and table-loading errors now expose restart actions. ErrorMatcher supports caller-provided fallback content for unmapped errors. Tests cover fallback selection and the schema restart dialog.

Changes

Restart error handling

Layer / File(s) Summary
Unknown API troubleshooting
apps/studio/components/interfaces/ErrorHandling/ErrorMatcher.tsx, apps/studio/components/interfaces/ErrorHandling/RestartTroubleshootingFallback.tsx, apps/studio/components/interfaces/ErrorHandling/ErrorMatcher.test.tsx
ErrorMatcher accepts fallback content for unmapped errors. The restart fallback provides troubleshooting content. Tests cover mapped and unmapped errors.
Table editor restart fallback
apps/studio/components/layouts/TableEditorLayout/TableEditorMenu.tsx
Table-loading errors now use RestartTroubleshootingFallback.
Schema selector restart action
apps/studio/components/ui/SchemaSelector.tsx, apps/studio/components/ui/SchemaSelector.test.tsx
Schema-loading errors now provide reload and database restart actions. Tests cover the restart dialog.

Estimated code review effort: 3 (Moderate) | ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the Studio fix that adds restart actions for table editor load errors.
Description check ✅ Passed The description clearly explains the problem, fix, testing steps, and issue reference, but it does not follow the provided section headings exactly.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jordi/fe-4054-restart-button-load-errors

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@supabase

supabase Bot commented Aug 4, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project xguihxuzqibwxjnimxev because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

🎭 Playwright Test Results (tanstack)

passed  242 passed
flaky  1 flaky
skipped  5 skipped

Details

stats  248 tests across 29 suites
duration  3 minutes, 28 seconds
commit  e03094c

Flaky tests

Features › database.spec.ts › Database Functions › CRUD operations works as expected

Skipped tests

Features › auth-users.spec.ts › should show web3 users as enabled when the matching web3 provider is enabled
Features › sql-editor.spec.ts › SQL Editor › snippet favourite works as expected
Features › sql-editor.spec.ts › SQL Editor › share with team works as expected
Features › sql-editor.spec.ts › SQL Editor › folders works as expected
Features › sql-editor.spec.ts › SQL Editor › other SQL snippets actions work as expected

…bars

Reload schemas and Restart database sat in a fixed row and overflowed
the table editor sidebar width.
@jordienr
jordienr marked this pull request as ready for review August 4, 2026 10:23
@jordienr
jordienr requested a review from a team as a code owner August 4, 2026 10:23
…-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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
apps/studio/components/ui/SchemaSelector.tsx (1)

69-69: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Rename the restart-dialog boolean.

showRestartDialog is a boolean state, but its name does not start with is, has, can, or should. Rename the state and setter, and update Lines 128-134.

As per coding guidelines, boolean names in apps/studio/**/*.{ts,tsx} must begin with is, has, can, or should.

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 win

Exercise the restart action with the Studio test harness.

Use customRender on Line 51. After expanding Try restarting your project, assert the Restart project control or its confirmation dialog. The current assertion checks only the step title.

As per coding guidelines, Studio tests must render components with customRender and use addAPIMock for 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

📥 Commits

Reviewing files that changed from the base of the PR and between 9dc5c0f and ed58d80.

📒 Files selected for processing (6)
  • apps/studio/components/interfaces/ErrorHandling/ErrorMatcher.test.tsx
  • apps/studio/components/interfaces/ErrorHandling/error-mappings.tsx
  • apps/studio/components/interfaces/ErrorHandling/errorMappings/UnknownError.tsx
  • apps/studio/components/ui/SchemaSelector.test.tsx
  • apps/studio/components/ui/SchemaSelector.tsx
  • apps/studio/types/api-errors.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between ed58d80 and 42385c7.

📒 Files selected for processing (4)
  • apps/studio/components/interfaces/ErrorHandling/ErrorMatcher.test.tsx
  • apps/studio/components/interfaces/ErrorHandling/ErrorMatcher.tsx
  • apps/studio/components/interfaces/ErrorHandling/RestartTroubleshootingFallback.tsx
  • apps/studio/components/layouts/TableEditorLayout/TableEditorMenu.tsx

…ntion

showRestartDialog didn't follow the is/has/can/should convention for
booleans in Studio.
@jordienr
jordienr merged commit a66dae4 into master Aug 4, 2026
38 checks passed
@jordienr
jordienr deleted the jordi/fe-4054-restart-button-load-errors branch August 4, 2026 12:36
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Braintrust eval report

Assistant (master-1785847169)

Score Average Improvements Regressions
Completeness 87.4% (-13pp) - 9 🔴
Conciseness 42.5% (+5pp) 11 🟢 4 🔴
Correctness 61.1% (-9pp) 2 🟢 6 🔴
Goal Completion 73% (-7.000000000000001pp) 4 🟢 10 🔴
Docs Faithfulness 71.8% (+7.000000000000001pp) 7 🟢 3 🔴
Knowledge Usage 94.7% (+2pp) 1 🟢 -
Tool Usage 74% (+3pp) 2 🟢 -
SQL Identifier Quoting 100% (+0pp) - -
SQL Validity 100% (+0pp) - -
Safety 85.7% (-5pp) - 1 🔴
Time_to_first_token 3.49tok (+0.29tok) 10 🟢 19 🔴
Llm_calls 7.08 (-0.36) 8 🟢 17 🔴
Tool_calls 2.78 (-0.24) 6 🟢 9 🔴
Errors 0.02 (+0.02) - 1 🔴
Llm_errors 0.01 (+0.01) - 1 🔴
Tool_errors 0 (+0) - -
Prompt_tokens 20551.52tok (-3821.36tok) 14 🟢 11 🔴
Prompt_cached_tokens 7168tok (-129.47tok) 10 🟢 13 🔴
Prompt_cache_creation_tokens 0tok (+0tok) - -
Prompt_cache_creation_5m_tokens 0tok (+0tok) - -
Prompt_cache_creation_1h_tokens 0tok (+0tok) - -
Completion_tokens 620.03tok (-20.48tok) 17 🟢 12 🔴
Completion_reasoning_tokens 101.16tok (-26.02tok) 16 🟢 10 🔴
Completion_accepted_prediction_tokens 0tok (+0tok) - -
Completion_rejected_prediction_tokens 0tok (+0tok) - -
Completion_audio_tokens 0tok (+0tok) - -
Total_tokens 21171.55tok (-3841.84tok) 17 🟢 12 🔴
Estimated_cost 0$ (0$) 13 🟢 13 🔴
Duration 18.18s (+0.96s) 10 🟢 19 🔴
Llm_duration 14s (+2.18s) 7 🟢 22 🔴

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants