fix: improve UX for empty repositories (#821)#836
Open
Naresh-official wants to merge 1 commit intosourcebot-dev:mainfrom
Open
fix: improve UX for empty repositories (#821)#836Naresh-official wants to merge 1 commit intosourcebot-dev:mainfrom
Naresh-official wants to merge 1 commit intosourcebot-dev:mainfrom
Conversation
- Add empty state UI with clear messaging in file tree and preview panels - Implement revision verification to gracefully handle empty repos - Replace generic error messages with user-friendly 'No commits yet' state - Add FolderOpen icon and helpful text for empty repository indication - Prevent rendering errors when repository has no children nodes Fixes sourcebot-dev#821
Contributor
WalkthroughThis PR enhances empty repository UX by adding detection and user-friendly empty-state messages. It implements revision verification in the file tree API, and conditionally renders empty-state UI components in the tree preview panel and file tree panel when repositories contain no commits or files. Additionally, it adds a guard condition in tree rendering to handle nodes without children. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix: Improve UX for empty repositories
Fixes #821
Problem
When viewing an empty repository, Sourcebot displayed generic error messages like "Error loading tree preview" or "Error loading file tree". This confused users by suggesting sync issues or internal errors when the repository simply had no commits yet.
Solution
This PR improves the user experience by:
Detecting empty repositories through revision verification
Displaying clear, user-friendly empty state UI
Replacing misleading error messages with helpful context
Changes Made
Added git rev-parse --verify checks in both getTree() and getFolderContents()
Gracefully handles empty repositories by returning empty data structures instead of throwing errors
Added empty state UI with FolderOpen icon
Displays "No files yet" message with explanatory text
Only shown when tree has no children (distinct from loading or error states)
Added empty state UI for folder preview
Shows "No commits yet" message with helpful context
Maintains PathHeader for navigation consistency
Added null check to prevent rendering errors
Safely handles nodes with no children
User Experience
Before: Generic error message suggesting a problem
After: Clear "No commits yet" / "No files yet" message with folder icon
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.