fix(sidebar): deduplicate projects in filter dropdown#1769
fix(sidebar): deduplicate projects in filter dropdown#1769
Conversation
| })) | ||
| .filter(r => r.displayName); | ||
| .filter(r => { | ||
| if (!r.displayName || seen.has(r.displayName)) return false; |
There was a problem hiding this comment.
WARNING: Deduplicating by displayName here makes the project filter incomplete
projectFilter still stores the raw gitUrl, and useSidebarSessions passes that through to unifiedSessions.list/search, where git_url is matched with =. If https://github.com/Org/repo and https://github.com/Org/repo.git collapse into one menu item, selecting it only shows sessions for whichever variant happened to be kept here; sessions stored under the other URL disappear from the filtered list. The filter key also needs to be normalized, or a single display name needs to map to all equivalent URLs.
Code Review SummaryStatus: 1 Issue Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Other Observations (not in diff)N/A Files Reviewed (1 files)
Fix these issues in Kilo Cloud Reviewed by gpt-5.4-20260305 · 303,809 tokens |
Summary
Deduplicate projects in the sidebar project filter dropdown. The same repository can be stored with different
git_urlformats acrosscli_sessionsandcli_sessions_v2(e.g.,https://github.com/Org/repovshttps://github.com/Org/repo.git). The SQL query groups by exactgit_url, butextractRepoFromGitUrl()normalizes both to the same display name, resulting in visually identical duplicate entries in the filter.The fix deduplicates by
displayNameafter mapping, keeping the first (most recently used) entry since the query results are already ordered bylast_used_at DESC.Verification
pnpm typecheck— passedVisual Changes
Reviewer Notes
The deduplication is done client-side in the
useMemothat buildsrecentProjects. An alternative would be normalizinggit_urlin the SQL query before grouping, but the client-side approach is simpler and doesn't risk breaking other consumers of the rawgit_urldata.