Skip to content

fix(ui, services): distinguish network errors from not found states (#144) - #156

Merged
aashu2006 merged 1 commit into
paro-studio:mainfrom
Tanmaypatil-25:fix/profile-prompt-load-error
Oct 20, 2026
Merged

aashu2006 merged 1 commit into
paro-studio:mainfrom
Tanmaypatil-25:fix/profile-prompt-load-error

Conversation

@Tanmaypatil-25

@Tanmaypatil-25 Tanmaypatil-25 commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Resolves #144.

Previously, network drops, server hiccups, or Supabase connection errors during profile and prompt loading were swallowing errors and returning null, causing the UI to falsely display "Profile not found" or "Prompt not found" rather than a query failure state.

Changes

  • Services (src/services/supabase/profiles.ts): Updated getProfile to only return null for legitimate "no rows found" errors (PGRST116). All other database/network errors are now re-thrown so React Query properly marks them as failed.
  • Prompt Detail (src/pages/PromptDetail.tsx): Refined query error handling to throw non-PGRST116 errors and wired up <QueryError> with a retry button when loading fails.
  • Profile Page (src/pages/Profile.tsx): Configured failure states to render <QueryError> and retry controls when profile fetching fails, reserving "not found" strictly for verified missing profiles.
  • Unit Tests: Added robust test suites covering both real missing entities (PGRST116) and transient network/server errors with successful retry recovery.

Testing & Verification

  • Verified all existing unit tests pass.
  • Added new test files/cases verifying correct error handling and retry mechanisms.
  • All 271 tests passing successfully.

Summary by CodeRabbit

  • Bug Fixes

    • Profile and prompt detail pages now distinguish between missing records and unexpected loading failures.
    • Added full-page and inline error states when existing content cannot be refreshed.
    • Added retry actions that allow users to recover after temporary profile or prompt loading errors.
    • Preserved dedicated “Profile not found” and “Prompt not found” states for missing records.
  • Tests

    • Added coverage for not-found responses, loading failures, retry behavior, and successful recovery.

@strix-security

Copy link
Copy Markdown

Strix is installed on this repository, but we couldn't run this PR security review because this workspace's trial has ended. Add a card to resume code reviews here.

So far, Strix has reviewed 14 pull requests across this workspace.

@github-actions github-actions Bot added the bug Something isn't working label Oct 20, 2026
@github-actions

Copy link
Copy Markdown

Thanks for the pull request, @Tanmaypatil-25. A couple of things from CONTRIBUTING.md before this can be reviewed:

Review is done by one person in their spare time, so these rules keep the queue moving for everyone.

@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 55961406-5ed7-444c-b429-3eda700e5de8
📥 Commits

Reviewing files that changed from the base of the PR and between 50f7129 and 332af75.

📒 Files selected for processing: 6
  • src/pages/Profile.test.tsx
  • src/pages/Profile.tsx
  • src/pages/PromptDetail.test.tsx
  • src/pages/PromptDetail.tsx
  • src/services/supabase/profiles.test.ts
  • src/services/supabase/profiles.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

📝 Walkthrough

Profile and prompt pages now show retryable errors when queries fail for reasons other than a missing record. A PGRST116 response continues to show the not-found state. The changes also add tests for missing records, query failures, and successful retries.

Changes: Profile and Prompt Load Errors

Layer / File(s) Summary
Classify missing records and query failures
src/services/supabase/profiles.ts, src/services/supabase/profiles.test.ts, src/pages/Profile.tsx, src/pages/PromptDetail.tsx
getProfile returns null only for PGRST116 and rethrows other errors. The profile and prompt queries track errors and fetching state.
Render and test retryable error states
src/pages/Profile.tsx, src/pages/Profile.test.tsx, src/pages/PromptDetail.tsx, src/pages/PromptDetail.test.tsx
The pages render full-page errors when query data is unavailable and inline errors when data remains available. Tests cover not-found responses, query errors, and recovery after retry.

Priority: ⬇️ Low

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

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: rahulkr182

Merge Risk: ⚪ Minimal · up to 332af

Profile and prompt pages now show a retry option on load failures and keep the not-found state only for genuinely missing records. No merge-blocking risk was found.

Pre-merge checks: Passed 6 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 6 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 6 passed
Check name Status Explanation
Description check Passed The description clearly explains the problem, solution, affected files, and test coverage. It does not use the template headings exactly and omits the required repository checklist.
Linked Issues check Passed The description references issue #144 and the implementation directly addresses its required outcomes for profile and prompt loading.
Out of Scope Changes check Passed The changes remain within the stated scope: profile and prompt pages, related Supabase profile handling, and tests for those behaviors.
Title check Passed The title clearly summarizes the primary change: distinguishing network errors from not-found states in the UI and services.
Linked Issues check Passed Issue #144 requires distinct handling for missing records and load failures. getProfile returns null only for PGRST116 and rethrows other errors. Profile and PromptDetail use React Query err…
Out of Scope Changes check Passed The changed production files implement the profile and prompt loading behavior required by issue #144. The changed test files cover the required missing-record and failure paths. The supplied change s…
Full details: Linked Issues check

Explanation

Issue #144 requires distinct handling for missing records and load failures. getProfile returns null only for PGRST116 and rethrows other errors. Profile and PromptDetail use React Query error state and render QueryError with retry callbacks. Both pages keep their not-found states for null data. The supplied PR evidence reports tests for PGRST116, transient errors, retry, and recovery.

Full details: Out of Scope Changes check

Explanation

The changed production files implement the profile and prompt loading behavior required by issue #144. The changed test files cover the required missing-record and failure paths. The supplied change summary identifies no unrelated production feature or unrelated test change.

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@aashu2006 aashu2006 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nice one @Tanmaypatil-25 , exactly what #144 needed 🙌

Real "not found" still shows not found, everything else gets a retry, and the tests cover both. Merging!

@aashu2006
aashu2006 merged commit 42ac1d3 into paro-studio:main Oct 20, 2026
14 checks passed

This branch was successfully deployed

1 active deployment
Preview — 332af753 Deployed Oct 20, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: profile and prompt pages say "not found" when loading failed

2 participants