Uh oh!
There was an error while loading. Please reload this page.
Improvement: Improved 404 page error for /browse - #837
Conversation
WalkthroughAdds a new FileNotFound component that renders a 404 UI for missing files in the browse flow and updates codePreviewPanel to render this component when the file-source response returns NOT_FOUND instead of a generic error. Changes
Sequence Diagram(s)sequenceDiagram
participant Browser
participant CodePreviewPanel
participant FileSourceAPI
participant RepoInfoAPI
participant FileNotFoundComponent
Browser->>CodePreviewPanel: Request file preview (repo, path, revision)
CodePreviewPanel->>RepoInfoAPI: fetch repoInfo
CodePreviewPanel->>FileSourceAPI: fetch fileSource
FileSourceAPI-->>CodePreviewPanel: NOT_FOUND
RepoInfoAPI-->>CodePreviewPanel: repoInfo (or error)
CodePreviewPanel->>FileNotFoundComponent: render(repoInfoResponse, fileSourceResponse, revision, path, repoName)
FileNotFoundComponent-->>Browser: display 404 UI with repo/branch/path and "Return to repository overview" link
Browser->>CodePreviewPanel: click "Return to repository overview"
CodePreviewPanel->>Browser: navigate to getBrowsePath(repoName, '/', pathType='tree', revision)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 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: 2
🤖 Fix all issues with AI agents
In `@packages/web/src/app/`[domain]/browse/[...path]/components/404NotFound.tsx:
- Around line 101-107: The "Return to the repository overview" Link in
404NotFound builds its href via getBrowsePath but omits the optional
revisionName, causing the link to drop branch context; update the Link's
getBrowsePath call to pass the component's revisionName value (alongside
repoName/repoInfoResponse.name, path '/', pathType 'tree' and
SINGLE_TENANT_ORG_DOMAIN) so the generated URL preserves the current branch;
modify the Link invocation where getBrowsePath is called (inside the 404NotFound
component) to include revisionName as the appropriate argument.
- Around line 1-22: Remove the client-side rendering directive and the unused
hook: delete the "'use client';" line at the top of 404NotFound.tsx and remove
the unused import "useEffect" so the component becomes a server component; keep
the RepoInfoResponse type (with indexedAt: Date | undefined) as-is since it will
now stay on the server, and ensure no client-only hooks or "use client"
directives are reintroduced in this file or in any components that receive
repoInfoResponse (refer to RepoInfoResponse and PathHeader to locate usages).
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
imsarang
commented
Feb 3, 2026
@brendan-kellam@msukkari |
brendan-kellam
commented
Feb 3, 2026
I will take a look at this later today |
imsarang
commented
Feb 5, 2026
@brendan-kellam can you check this PR? |
imsarang
commented
Feb 7, 2026
Hi, can this PR be merged? @brendan-kellam@msukkari |
brendan-kellam
commented
Feb 9, 2026
@imsarang sorry we've been swamped. I will try and get to this later today |
imsarang
commented
Feb 10, 2026
yea sure, we can merge this once this good for merge after reviews. |
imsarang
commented
Feb 11, 2026
@brendan-kellam review required |
imsarang
commented
Feb 20, 2026
@brendan-kellam can you review this PR? this has been there for a month, we can close this one |
The below ss is the updated screen for 404 not found when trying to browse for file that doesnot exist.
inspiration: Github
issue link: #827
Summary by CodeRabbit