fix(ui): handle undefined branch names in autocomplete components#752
fix(ui): handle undefined branch names in autocomplete components#752wcpaxx wants to merge 2 commits intoAutoMaker-Org:mainfrom
Conversation
Add defensive checks to prevent TypeError when branch names are undefined or null in the autocomplete and branch-related components. Changes: - Filter out options with undefined/null values in Autocomplete - Use optional chaining for toLowerCase() calls - Add null/empty string filtering in branch-autocomplete - Add b.name checks in board-view, graph-view-page, and dialogs This fixes crashes when opening AddFeature dialog with certain project data that may contain invalid branch references. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Summary of ChangesHello @wcpaxx, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a critical Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
📝 WalkthroughWalkthroughAdds null/undefined guards and trims empty branch/name values across several UI components; extends Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Poem
🚥 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.
Code Review
This pull request effectively addresses the TypeError caused by undefined branch names in autocomplete components. The solution is robust, with defensive checks added at multiple layers, from the generic Autocomplete component to specific views and dialogs. This ensures that null or undefined values are handled gracefully, preventing crashes.
I've added a couple of suggestions in autocomplete.tsx to further improve code clarity and efficiency by centralizing the filtering of invalid options. Overall, this is a solid fix that improves the application's stability.
ad187dd to
c690bab
Compare
Summary
toLowerCase()calls to prevent crashesb.namechecks in board-view, graph-view-page, and related dialogsProblem
Opening the AddFeature dialog with certain project data that contains invalid branch references causes a crash:
This happens when the branches array contains undefined values, which then get passed to the Autocomplete component where
toLowerCase()is called without null checks.Solution
Added defensive filtering and optional chaining at multiple levels:
&& b.namechecks when filtering branchesTest plan
🤖 Generated with Claude Code
Summary by CodeRabbit