fix: Merge project groups that resolve to the same projectPath#44
Merged
Conversation
Two ~/.claude/projects/<folder>/ directories can resolve to the same project cwd because Claude Code's folder-name encoding scheme has changed over time (older runs encoded dots/spaces/@ as dashes; newer runs preserve them literally). buildProjectsFromCache previously keyed its projectMap by on-disk folder name, so the sidebar rendered both folders as separate groups. This also caused the sidebar to accumulate duplicate DOM nodes on every re-render (toggling the active-session filter, etc.) — morphdom keys on node.id, and project group ids derive from projectPath, so duplicate projectPath entries produced colliding ids that morphdom couldn't reconcile. Key the map by projectPath instead, merging cached rows, empty-folder fallback entries, and active-terminal injections from all encodings into a single project group.
…ct-paths # Conflicts: # session-cache.js
Contributor
|
Do you know if this is related to this recent change? see issue #43 |
Contributor
Author
It could be, as i think i only saw this issue in the newer version |
- buildProjectsFromCache now stores folder: encodeProjectPath(projectPath) for every projectMap insertion, so the merged group's id is deterministic regardless of which legacy on-disk folder happened to be scanned first. - Empty-dirs pass reads folder→projectPath through cache_meta (one query) instead of calling deriveProjectPath per folder per render. Folders the indexer hasn't seen yet fall back to deriveProjectPath and backfill cache_meta so subsequent renders are pure DB lookups. - Wire getAllFolderMeta through main.js → sessionCache.init. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
navedr
added a commit
to navedr/switchboard
that referenced
this pull request
May 13, 2026
…octly#44) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
navedr
added a commit
to navedr/switchboard
that referenced
this pull request
May 13, 2026
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
~/.claude/projects/<folder>/directories can resolve to the same projectcwdbecause Claude Code's folder-name encoding scheme has changed over time (older runs encoded dots/spaces/@as dashes; newer runs preserve them literally). The sidebar rendered both folders as separate groups.node.id, and project-group ids derive fromprojectPath, so duplicateprojectPathentries produced colliding ids that morphdom couldn't reconcile.buildProjectsFromCachenow keysprojectMapbyprojectPath, so cached rows, empty-folder fallback entries, and active-terminal injections from all encodings merge into one project group.before

Test plan
My Drive/Obsidian Vault(and any other project with two encoded folder names) shows as a single sidebar group with sessions from both folders.npm teststill passes.