Skip to content

fix(dashboard): readable summary color + surface delete errors#9

Merged
hallelx2 merged 1 commit into
mainfrom
halleluyaholudele/fix-summary-color-delete-errors
Jul 3, 2026
Merged

fix(dashboard): readable summary color + surface delete errors#9
hallelx2 merged 1 commit into
mainfrom
halleluyaholudele/fix-summary-color-delete-errors

Conversation

@hallelx2

@hallelx2 hallelx2 commented Jul 3, 2026

Copy link
Copy Markdown
Owner
  • Summary color: section summaries rendered too faint (text-muted-foreground on white cards). Now text-foreground/75 — a readable dark gray. Also removed a misleading text-secondary wrapper (maps to the light shadcn secondary, not dark ink).
  • Delete errors: the delete handlers swallowed failures silently (catch {}, only acted if (res.ok)), so a failing delete looked like nothing happened. Now they surface the HTTP status + error message — so we can finally see why delete is failing.

Summary by CodeRabbit

  • Bug Fixes
    • Improved document deletion feedback by showing clearer error messages when a delete request fails, including status details when available.
    • Added a visible alert for network or thrown errors during deletion instead of failing silently.
    • Ensured deletion stops cleanly after a successful redirect.
    • Updated summary text styling to improve readability with stronger contrast.

- MarkdownSummary: summary paragraphs were text-muted-foreground (too
  faint on white cards); use text-foreground/75 for a readable dark gray.
  Also drop a misleading text-secondary wrapper in the section tree
  (text-secondary maps to the light shadcn secondary, not dark ink).
- Delete handlers (list + detail): stop swallowing failures silently;
  surface the HTTP status + error so a failed delete is visible instead
  of appearing to do nothing.
@vercel

vercel Bot commented Jul 3, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
vectorless-web Ready Ready Preview, Comment Jul 3, 2026 12:06pm

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Sorry @hallelx2, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR updates delete error handling in the document detail and documents list pages to surface HTTP status and error messages via alerts instead of failing silently, and adjusts MarkdownSummary text styling and its usage in the document detail page's section tree.

Changes

Document delete and summary UI updates

Layer / File(s) Summary
Delete error handling
apps/web/app/(dashboard)/dashboard/documents/[docId]/page.tsx, apps/web/app/(dashboard)/dashboard/documents/page.tsx
Failed DELETE responses now parse a JSON error field and alert with HTTP status plus message; thrown/network errors alert with the error message or a generic fallback instead of failing silently.
Summary rendering and styling
apps/web/app/(dashboard)/dashboard/documents/[docId]/page.tsx, apps/web/components/ui/markdown.tsx
Section summaries render MarkdownSummary directly without a text-secondary wrapper, and MarkdownSummary paragraph and list item classes switch to text-foreground/75.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main changes: improving summary readability and surfacing delete errors in the dashboard.
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 halleluyaholudele/fix-summary-color-delete-errors

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

apps/web/app/(dashboard)/dashboard/documents/[docId]/page.tsx

Oops! Something went wrong! :(

ESLint: 9.39.1

TypeError: Converting circular structure to JSON
--> starting at object with constructor 'Object'
| property 'configs' -> object with constructor 'Object'
| property 'flat' -> object with constructor 'Object'
| ...
| property 'plugins' -> object with constructor 'Object'
--- property 'react' closes the circle
Referenced from: /apps/web/.eslintrc.json
at JSON.stringify ()
at /node_modules/.pnpm/@eslint+eslintrc@3.3.5/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2255:45
at Array.map ()
at ConfigValidator.formatErrors (/node_modules/.pnpm/@eslint+eslintrc@3.3.5/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2246:23)
at ConfigValidator.validateConfigSchema (/node_modules/.pnpm/@eslint+eslintrc@3.3.5/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2277:84)
at ConfigArrayFactory._normalizeConfigData (/node_modules/.pnpm/@eslint+eslintrc@3.3.5/node_modules

... [truncated 455 characters] ...

c/dist/eslintrc.cjs:3261:25)
at ConfigArrayFactory._normalizeObjectConfigDataBody (/node_modules/.pnpm/@eslint+eslintrc@3.3.5/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3199:25)
(node:2) ESLintRCWarning: You are using an eslintrc configuration file, which is deprecated and support will be removed in v10.0.0. Please migrate to an eslint.config.js file. See https://eslint.org/docs/latest/use/configure/migration-guide for details. An eslintrc configuration file is used because you have the ESLINT_USE_FLAT_CONFIG environment variable set to false. If you want to use an eslint.config.js file, remove the environment variable. If you want to find the location of the eslintrc configuration file, use the --debug flag.
(Use node --trace-warnings ... to show where the warning was created)

apps/web/app/(dashboard)/dashboard/documents/page.tsx

Oops! Something went wrong! :(

ESLint: 9.39.1

TypeError: Converting circular structure to JSON
--> starting at object with constructor 'Object'
| property 'configs' -> object with constructor 'Object'
| property 'flat' -> object with constructor 'Object'
| ...
| property 'plugins' -> object with constructor 'Object'
--- property 'react' closes the circle
Referenced from: /apps/web/.eslintrc.json
at JSON.stringify ()
at /node_modules/.pnpm/@eslint+eslintrc@3.3.5/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2255:45
at Array.map ()
at ConfigValidator.formatErrors (/node_modules/.pnpm/@eslint+eslintrc@3.3.5/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2246:23)
at ConfigValidator.validateConfigSchema (/node_modules/.pnpm/@eslint+eslintrc@3.3.5/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2277:84)
at ConfigArrayFactory._normalizeConfigData (/node_modules/.pnpm/@eslint+eslintrc@3.3.5/node_modules

... [truncated 455 characters] ...

c/dist/eslintrc.cjs:3261:25)
at ConfigArrayFactory._normalizeObjectConfigDataBody (/node_modules/.pnpm/@eslint+eslintrc@3.3.5/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3199:25)
(node:2) ESLintRCWarning: You are using an eslintrc configuration file, which is deprecated and support will be removed in v10.0.0. Please migrate to an eslint.config.js file. See https://eslint.org/docs/latest/use/configure/migration-guide for details. An eslintrc configuration file is used because you have the ESLINT_USE_FLAT_CONFIG environment variable set to false. If you want to use an eslint.config.js file, remove the environment variable. If you want to find the location of the eslintrc configuration file, use the --debug flag.
(Use node --trace-warnings ... to show where the warning was created)

apps/web/components/ui/markdown.tsx

Oops! Something went wrong! :(

ESLint: 9.39.1

TypeError: Converting circular structure to JSON
--> starting at object with constructor 'Object'
| property 'configs' -> object with constructor 'Object'
| property 'flat' -> object with constructor 'Object'
| ...
| property 'plugins' -> object with constructor 'Object'
--- property 'react' closes the circle
Referenced from: /apps/web/.eslintrc.json
at JSON.stringify ()
at /node_modules/.pnpm/@eslint+eslintrc@3.3.5/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2255:45
at Array.map ()
at ConfigValidator.formatErrors (/node_modules/.pnpm/@eslint+eslintrc@3.3.5/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2246:23)
at ConfigValidator.validateConfigSchema (/node_modules/.pnpm/@eslint+eslintrc@3.3.5/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2277:84)
at ConfigArrayFactory._normalizeConfigData (/node_modules/.pnpm/@eslint+eslintrc@3.3.5/node_modules

... [truncated 455 characters] ...

c/dist/eslintrc.cjs:3261:25)
at ConfigArrayFactory._normalizeObjectConfigDataBody (/node_modules/.pnpm/@eslint+eslintrc@3.3.5/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3199:25)
(node:2) ESLintRCWarning: You are using an eslintrc configuration file, which is deprecated and support will be removed in v10.0.0. Please migrate to an eslint.config.js file. See https://eslint.org/docs/latest/use/configure/migration-guide for details. An eslintrc configuration file is used because you have the ESLINT_USE_FLAT_CONFIG environment variable set to false. If you want to use an eslint.config.js file, remove the environment variable. If you want to find the location of the eslintrc configuration file, use the --debug flag.
(Use node --trace-warnings ... to show where the warning was created)


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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
apps/web/app/(dashboard)/dashboard/documents/[docId]/page.tsx (1)

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

Consider extracting shared delete-error handling.

This exact error-parsing/alert pattern (parse optional JSON error, alert with HTTP status, catch/alert on network error) is duplicated verbatim in apps/web/app/(dashboard)/dashboard/documents/page.tsx. Extracting a small shared helper (e.g. deleteDocument(docId) returning a result/throwing a formatted error) would avoid drift between the two copies.

♻️ Suggested shared helper
// e.g. apps/web/lib/documents.ts
export async function deleteDocument(docId: string): Promise<void> {
  const res = await fetch(`/api/dashboard/documents/${docId}`, { method: "DELETE" });
  if (res.ok) return;
  const body = (await res.json().catch(() => null)) as { error?: string } | null;
  throw new Error(`Delete failed (HTTP ${res.status})${body?.error ? `: ${body.error}` : ""}`);
}

Both call sites then just try { await deleteDocument(docId); ... } catch (e) { alert(e instanceof Error ? e.message : "Delete failed: network error"); }.

🤖 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/web/app/`(dashboard)/dashboard/documents/[docId]/page.tsx around lines
337 - 361, The delete flow in handleDelete duplicates the same HTTP/JSON error
parsing and alert formatting used in the documents list page, so extract that
logic into a shared helper such as deleteDocument(docId) and reuse it from both
call sites. Move the fetch + optional body.error parsing into the helper, have
it return success or throw a formatted Error, and keep the page-level try/catch
in page.tsx limited to navigation and a single alert fallback for network
errors.
🤖 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/web/app/`(dashboard)/dashboard/documents/[docId]/page.tsx:
- Around line 337-361: The delete flow in handleDelete duplicates the same
HTTP/JSON error parsing and alert formatting used in the documents list page, so
extract that logic into a shared helper such as deleteDocument(docId) and reuse
it from both call sites. Move the fetch + optional body.error parsing into the
helper, have it return success or throw a formatted Error, and keep the
page-level try/catch in page.tsx limited to navigation and a single alert
fallback for network errors.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 31b61644-b19f-47dc-958e-95f9320c6363

📥 Commits

Reviewing files that changed from the base of the PR and between 8ce8acc and d4c984d.

📒 Files selected for processing (3)
  • apps/web/app/(dashboard)/dashboard/documents/[docId]/page.tsx
  • apps/web/app/(dashboard)/dashboard/documents/page.tsx
  • apps/web/components/ui/markdown.tsx

@hallelx2 hallelx2 merged commit 16d2ab9 into main Jul 3, 2026
8 checks passed
@hallelx2 hallelx2 deleted the halleluyaholudele/fix-summary-color-delete-errors branch July 3, 2026 12:08
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.

1 participant