Repository navigation
fix(app): show subfolder sessions under their project in Home - #65443
MykolaBiron wants to merge 1 commit into
Conversation
Home kept only sessions whose directory exactly equals the selected project's worktree or sandbox, so a session started in a subfolder (for example personal/android-app) vanished from its own project. Match sessions whose directory is a selected directory or a path-segment descendant of it, unless a separately added nested project owns that subfolder. The scoped fetch also lists the selected project's sessions by project ID, since the server's directory filter is exact. The shared global project is skipped there so it does not pull in unrelated folders. Fixes anomalyco#65362 (part A)
There was a problem hiding this comment.
This looks like a sound fix for part A of the issue.
How I checked
- I ran the issue's reproduction against a server from this branch. Listing by the project's root folder still returns only the root session (the server code is the same on the base). Listing by project ID, which this PR adds, returns both the root and the
android-appsession. - The three new
records.test.tscases fail on the base and pass here. - All 68 tests in
src/homepass, andtsc -bis clean. - I could not open the Home UI itself. Could you add a before/after screenshot of Home with a subfolder session?
Public API: unchanged. The change is client-only and uses the project filter that session.list already accepts.
Concerns
- The client filter matches by folder path alone, not by the session's project ID (see the inline comment). Unadded nested repos, and subfolders of non-git folders, can end up under the selected project.
- Not blocking: the per-project browse view (
projects/browse-view.tsx) still filters by exact folder, so it will keep hiding these sessions.
|
|
||
| return selected.some( | ||
| (root) => | ||
| containsDirectory(root, directory) && |
There was a problem hiding this comment.
This matches by path only, so any loaded session in a subfolder of the selected folder now shows under the project, whatever its projectID. Examples:
- A nested git repo that was never added as a project, such as a vendored clone or a submodule with its own project ID.
- A subfolder of a non-git (
global) selected folder. That's the case the query inqueries.tsdeliberately skips, so the two halves disagree.
Could subfolder matches also require session.projectID === selectedProject.id, and skip them for global? Exact folder matches would stay as they are. That would line up with the project-ID fetch and mostly make the nested-project scan unnecessary. It would also avoid rebuilding that scan for every session.
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
|
Came to say, I applied this locally and it works for me: with a project selected on Home, my sessions opened in a subfolder of the repository show again. This bug hides most of my sessions.... I found one more place with the same exact-folder filter: the project history view in the Desktop Projects sidebar? |
Issue for this PR
Closes #65362 (part A only)
Type of change
What does this PR do?
Home hid sessions that run in a subfolder of the selected project. A session in
personal/android-appdid not show underpersonal, even with the same project ID.There were two causes. The Home filter in
records.tsmatched directories exactly. The scoped fetch inqueries.tsalso asked the server by exact directory, so subfolder sessions of quiet projects were never loaded.The fix:
records.tskeeps sessions in a selected directory or any subfolder of it. It uses the existing containsDirectory helper, so/repo/abdoes not match/repo/aand Windows paths work. Sessions of a separately added nested project stay with that project.queries.tsalso lists the selected project's sessions by project ID. It skips the sharedglobalproject, which spans unrelated folders.Part B of the issue looks like #55133, so I left it out.
How did you verify your code works?
records.test.ts: a subfolder session, Windows path variants, and a nested added project. They failed before the fix and pass after it.packages/app/src/homepass.Screenshots / recordings
None. I verified the change with unit tests and did not run the desktop app.
Checklist