Skip to content

fix: Merge project groups that resolve to the same projectPath#44

Merged
abasiri merged 3 commits into
doctly:mainfrom
HaydnG:fix/duplicate-project-paths
May 12, 2026
Merged

fix: Merge project groups that resolve to the same projectPath#44
abasiri merged 3 commits into
doctly:mainfrom
HaydnG:fix/duplicate-project-paths

Conversation

@HaydnG

@HaydnG HaydnG commented May 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • 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). The sidebar rendered both folders as separate groups.
  • Toggling the active-session filter (or any other re-render) accumulated extra duplicate DOM nodes — morphdom keys on node.id, and project-group ids derive from projectPath, so duplicate projectPath entries produced colliding ids that morphdom couldn't reconcile.
  • buildProjectsFromCache now keys projectMap by projectPath, so cached rows, empty-folder fallback entries, and active-terminal injections from all encodings merge into one project group.

before
image

Test plan

  • Launch app — My Drive/Obsidian Vault (and any other project with two encoded folder names) shows as a single sidebar group with sessions from both folders.
  • Toggle the active-session filter several times; no duplicate groups accumulate.
  • Add a brand new project (no existing folder) — still appears.
  • Hide a duplicated project — both folder encodings disappear from the sidebar.
  • npm test still passes.

HaydnG added 2 commits May 7, 2026 17:11
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.
@HaydnG HaydnG marked this pull request as ready for review May 8, 2026 09:23
@HaydnG HaydnG changed the title Merge project groups that resolve to the same projectPath fix: Merge project groups that resolve to the same projectPath May 8, 2026
@abasiri

abasiri commented May 8, 2026

Copy link
Copy Markdown
Contributor

Do you know if this is related to this recent change? see issue #43

@HaydnG

HaydnG commented May 11, 2026

Copy link
Copy Markdown
Contributor Author

Do you know if this is related to this recent change? see issue #43

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>
@abasiri abasiri merged commit 1a9546c into doctly:main May 12, 2026
5 checks passed
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants