fix: PSQL console error flash, Open in Explorer on Windows, silent catch blocks#211
Conversation
…tch blocks - PSQL console: commit PsqlConsoleEntry in all early-return paths so error messages don't disappear after the 300ms live-output grace period - Open in Explorer: resolve parent directory for empty tabs, add toast feedback on failure (Windows explorer /select, needs existing file) - DatabaseExplorer: Drop Role, DDL load failures now show error dialogs - MainContent: ER Diagram connection failure shows toast instead of silent return - ERDDialog: SVG export failure shows error dialog instead of silent catch
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reached
More reviews will be available in 40 minutes and 23 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR adds user-facing error feedback across the application by replacing silent failures and transient error display with persistent dialogs, toasts, and console entries. Database explorer operations, file manager interactions, PSQL execution stages, watch commands, and ERD operations now inform users of failures instead of logging them silently. ChangesError Feedback Throughout Components
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
src/components/explorer/DatabaseExplorer.tsx (1)
1767-1777:⚠️ Potential issue | 🟠 Major | ⚡ Quick winUse the same qualified-name resolution for Enter-triggered DDL loads.
Line 1768 only special-cases tables and otherwise falls back to
node.name, so pressing Enter on schema-qualified objects like views/functions/indexes still callsgetDDLwith the unqualified name. The new dialog will show the failure, but keyboard DDL remains broken for those nodes.Proposed fix
+const resolveDdlTarget = (node: TreeNode) => { + let iconType = node.icon; + let targetName = node.name; + const fullPath = node.id.split("-").slice(1).join("-"); + + if (fullPath.includes(".")) { + targetName = fullPath; + } + + return { iconType, targetName }; +}; + ... } else if (isLeafSchemaItem(node.icon)) { (async () => { try { - const targetName = node.id.startsWith("table-") ? node.id.replace("table-", "") : node.name; - const ddl = await getDDL(node.icon, targetName); + const { iconType, targetName } = resolveDdlTarget(node); + const ddl = await getDDL(iconType, targetName); if (ddl) { window.dispatchEvent(new CustomEvent("open-query-with-text", { detail: { query: ddl, name: `DDL ${node.name}` }🤖 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 `@src/components/explorer/DatabaseExplorer.tsx` around lines 1767 - 1777, The Enter-key DDL path only special-cases "table-" and falls back to node.name, so schema-qualified objects lose their qualifier; change the targetName computation used before calling getDDL to strip any leading type-prefix up to the first hyphen (e.g., replace /^[^-]+-/ with '') when node.id contains a hyphen, otherwise use node.name, then pass that targetName to getDDL (references: node.id, node.name, getDDL).src/components/layout/MainContent.tsx (1)
1367-1389:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winMark failed
\watchruns as errors.The loop above appends
ERROR in watch: ..., but Line 1388 only checks forERROR:/FATAL:. A failed watch therefore gets persisted as a non-error console entry.Proposed fix
- hasErrors: watchOutput.some(l => l.startsWith("ERROR:") || l.startsWith("FATAL:")), + hasErrors: watchOutput.some( + l => + l.startsWith("ERROR:") || + l.startsWith("FATAL:") || + l.startsWith("ERROR in watch:") + ),🤖 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 `@src/components/layout/MainContent.tsx` around lines 1367 - 1389, The persisted watch entry is not flagged as an error because hasErrors only checks for "ERROR:"/ "FATAL:" but the loop appends "ERROR in watch: ..."; update the hasErrors computation when creating the watchEntry (where PsqlConsoleEntry is constructed using watchCmd, watchOutput from psqlOutputRef.current and executionTime) to also detect the appended watch failure string (e.g., lines starting with "ERROR in watch" or containing "ERROR in watch:") — i.e., change the predicate used for hasErrors (currently l.startsWith("ERROR:") || l.startsWith("FATAL:")) to include the watch-error pattern so failed watch runs are marked as errors.src/components/tools/ERDDialog.tsx (1)
241-281:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winAdd
confirmDialogto theexportSVGuseCallbackdependency list
exportSVGcallsconfirmDialog.dialog(...), but its dependency array only includesselectedDatabase, which can lead to stale closure behavior / hook-lint drift.Suggested fix
- }, [selectedDatabase]); + }, [selectedDatabase, confirmDialog]);🤖 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 `@src/components/tools/ERDDialog.tsx` around lines 241 - 281, The exportSVG useCallback captures confirmDialog but only lists selectedDatabase in its dependency array, risking a stale closure; update the useCallback dependencies for exportSVG to include confirmDialog (e.g., useCallback(..., [selectedDatabase, confirmDialog]) or the specific dialog method reference) so the latest confirmDialog instance is used when calling confirmDialog.dialog(...) inside exportSVG.
🤖 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 `@src/components/layout/MainContent.tsx`:
- Around line 996-1009: The current code calls clearPsqlOutput() immediately
after updateTabState(...), which also clears stashPsqlOutputRef and can lead to
a blank PSQL frame on a split React commit; instead, only clear the live
psqlOutput state here (e.g., set psqlOutput: [] in updateTabState) and do NOT
call clearPsqlOutput() so stashPsqlOutputRef remains populated until the next
command starts; apply this change to the error-path blocks around updateTabState
in the functions/blocks using updateTabState, clearPsqlOutput, psqlOutputRef,
stashPsqlOutputRef and runningCmdRef (the same pattern at the other locations
you noted).
---
Outside diff comments:
In `@src/components/explorer/DatabaseExplorer.tsx`:
- Around line 1767-1777: The Enter-key DDL path only special-cases "table-" and
falls back to node.name, so schema-qualified objects lose their qualifier;
change the targetName computation used before calling getDDL to strip any
leading type-prefix up to the first hyphen (e.g., replace /^[^-]+-/ with '')
when node.id contains a hyphen, otherwise use node.name, then pass that
targetName to getDDL (references: node.id, node.name, getDDL).
In `@src/components/layout/MainContent.tsx`:
- Around line 1367-1389: The persisted watch entry is not flagged as an error
because hasErrors only checks for "ERROR:"/ "FATAL:" but the loop appends "ERROR
in watch: ..."; update the hasErrors computation when creating the watchEntry
(where PsqlConsoleEntry is constructed using watchCmd, watchOutput from
psqlOutputRef.current and executionTime) to also detect the appended watch
failure string (e.g., lines starting with "ERROR in watch" or containing "ERROR
in watch:") — i.e., change the predicate used for hasErrors (currently
l.startsWith("ERROR:") || l.startsWith("FATAL:")) to include the watch-error
pattern so failed watch runs are marked as errors.
In `@src/components/tools/ERDDialog.tsx`:
- Around line 241-281: The exportSVG useCallback captures confirmDialog but only
lists selectedDatabase in its dependency array, risking a stale closure; update
the useCallback dependencies for exportSVG to include confirmDialog (e.g.,
useCallback(..., [selectedDatabase, confirmDialog]) or the specific dialog
method reference) so the latest confirmDialog instance is used when calling
confirmDialog.dialog(...) inside exportSVG.
🪄 Autofix (Beta)
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: defaults
Review profile: CHILL
Plan: Pro
Run ID: 54b2095f-6959-4959-b212-a37c0aeaf1f8
📒 Files selected for processing (4)
CHANGELOG.mdsrc/components/explorer/DatabaseExplorer.tsxsrc/components/layout/MainContent.tsxsrc/components/tools/ERDDialog.tsx
…rame Replace clearPsqlOutput() with inline ref+state clear at 8 entry-commit sites so stashPsqlOutputRef survives the commit. This prevents the PsqlWindow liveOutput fallback from going blank during split React commits on WebView2/Windows.
PSQL console: commit PsqlConsoleEntry in all early-return paths so error messages don't disappear after the 300ms live-output grace period
Open in Explorer: resolve parent directory for empty tabs, add toast feedback on failure (Windows explorer /select, needs existing file)
DatabaseExplorer: Drop Role, DDL load failures now show error dialogs
MainContent: ER Diagram connection failure shows toast instead of silent return
ERDDialog: SVG export failure shows error dialog instead of silent catch
Summary
Related issue
Changes
Testing notes
Checklist
npm run tauri devornpm run tauri build) and verified the change works.npx tsc --noEmit).cargo check --manifest-path src-tauri/Cargo.toml).#[tauri::command], I registered it insrc-tauri/src/lib.rs'sgenerate_handler!.CHANGELOG.mdunder## [Unreleased].storage.rs,updater.rs,capabilities/, or the AI assistant code path, I flagged it in the summary above.Summary by CodeRabbit
Bug Fixes