| … | … | @@ -104,8 +105,31 @@ export default function FileBrowserPanel({ | |
| 112 | + | ready, | |
| 113 | + | error, | |
| 114 | + | isPending, | |
| 115 | + | } = useDirectoryEntries(environmentId, cwd); | |
π High files/FileBrowserPanel.tsx:115
Switching environmentId or cwd leaves the panel showing the previous workspace's entries, because useDirectoryEntries retains its loaded root cache and skips the new load("") call; an in-flight request from the old workspace can also be committed to the new one. Reset/version the hook state and abort or isolate requests whenever these inputs change.
Also found in 1 other location(s)
apps/web/src/components/files/useDirectoryEntries.ts:25
The hook keeps
directories,loaded, andrequestsacross changes toenvironmentIdorcwd, but the effect only callsload(""). Sinceloadedalready contains the root, that call returns immediately and the panel continues displaying the previous workspace's tree. If an old request is in flight, the sharedactiveflag is set back to true by the new effect, so its result can also be committed as the new workspace's root. Clear/version these caches (and isolate/abort old requests) when the hook inputs change.
π€ Copy this AI Prompt to have your agent fix this:
| 1 | In file @apps/web/src/components/files/FileBrowserPanel.tsx around line 115: |
| 2 | |
| 3 | Switching `environmentId` or `cwd` leaves the panel showing the previous workspace's entries, because `useDirectoryEntries` retains its `loaded` root cache and skips the new `load("")` call; an in-flight request from the old workspace can also be committed to the new one. Reset/version the hook state and abort or isolate requests whenever these inputs change. |
| 4 | |
| 5 | Also found in 1 other location(s): |
| 6 | - apps/web/src/components/files/useDirectoryEntries.ts:25 -- The hook keeps `directories`, `loaded`, and `requests` across changes to `environmentId` or `cwd`, but the effect only calls `load("")`. Since `loaded` already contains the root, that call returns immediately and the panel continues displaying the previous workspace's tree. If an old request is in flight, the shared `active` flag is set back to true by the new effect, so its result can also be committed as the new workspace's root. Clear/version these caches (and isolate/abort old requests) when the hook inputs change. |
Note
Written by gpt-6 on behalf of Maria
the caller already isolates this cache: FilePreviewPanel.tsx keys FileBrowserPanel with ${environmentId}:${cwd}. changing either value unmounts the old hook and creates new state; the old instance's active guard prevents pending results from writing after unmount. no cache-reset change is needed.
| … | … | @@ -266,6 +270,78 @@ export const make = Effect.gen(function* () { | |
| 324 | + | .run({ | |
| 325 | + | operation: "WorkspaceEntries.list", | |
| 326 | + | command: "git", | |
| 327 | + | args: ["-c", "core.fsmonitor=false", "check-ignore", "--no-index", "-z", "--stdin"], | |
π‘ Medium workspace/WorkspaceEntries.ts:327
--no-index makes git check-ignore classify tracked files as ignored, so a committed file covered by a later .gitignore rule is incorrectly returned with ignored: true in the UI. Remove --no-index so tracked paths retain Git's normal ignore semantics.
π€ Copy this AI Prompt to have your agent fix this:
| 1 | In file @apps/server/src/workspace/WorkspaceEntries.ts around line 327: |
| 2 | |
| 3 | `--no-index` makes `git check-ignore` classify tracked files as ignored, so a committed file covered by a later `.gitignore` rule is incorrectly returned with `ignored: true` in the UI. Remove `--no-index` so tracked paths retain Git's normal ignore semantics. |
Note
Written by gpt-6 on behalf of Maria
fixed in 41c6248076 by removing --no-index. the existing directory-listing test now stages a tracked file before adding a matching ignore rule and verifies that it stays unmarked. all 33 workspace entry tests pass.
| … | … | @@ -0,0 +1,124 @@ | |
| 61 | + | return next; | |
| 62 | + | }); | |
| 63 | + | } else { | |
| 64 | + | const cause = Cause.squash(result.cause); | |
π‘ Medium files/useDirectoryEntries.ts:64
A failed directory request remains marked as loaded, so later expansion of that folder returns immediately without retrying and leaves it empty until the whole tree is refreshed. Remove directoryPath from loaded in the non-success branch so the next expansion can issue a new request.
No longer relevant as of 41c6248076d6dda23f73e125124734796eb6eb81
Note
Written by gpt-6 on behalf of Maria
fixed in 41c6248076. failed requests clear the loaded marker, repeat expansion issues a fresh query, and refresh retains all attempted paths. expansion transitions prevent automatic retry loops.
| … | … | @@ -104,8 +105,31 @@ export default function FileBrowserPanel({ | |
| 118 | + | const pathSearch = useProjectPathSearch({ environmentId, cwd, query: query.slice(0, 256) }, 200); | |
| 119 | + | const entries = useMemo(() => { | |
| 120 | + | const result = new Map(directoryEntries.map((entry) => [entry.path, entry])); | |
| 121 | + | if (query.trim() && !pathSearch.isPending) { | |
π‘ Medium files/FileBrowserPanel.tsx:121
A search-only result disappears after the file is opened and the search is cleared, leaving the browser without the selected file or its folder. Because onSelectionChange marks the result as tree-originated, the reveal effect skips loading its ancestors; once query is empty, line 121 no longer injects the result or its synthetic parents, and handledRevealRef prevents a later reveal. Load the selected result's parent chain when it is opened, or retain and reveal it after closing search.
π€ Copy this AI Prompt to have your agent fix this:
| 1 | In file @apps/web/src/components/files/FileBrowserPanel.tsx around line 121: |
| 2 | |
| 3 | A search-only result disappears after the file is opened and the search is cleared, leaving the browser without the selected file or its folder. Because `onSelectionChange` marks the result as tree-originated, the reveal effect skips loading its ancestors; once `query` is empty, line 121 no longer injects the result or its synthetic parents, and `handledRevealRef` prevents a later reveal. Load the selected result's parent chain when it is opened, or retain and reveal it after closing search. |
Note
Written by gpt-6 on behalf of Maria
fixed in 41c6248076. the selected-path effect already loads ancestors independently of the reveal effect; the reveal marker now resets when clearing search temporarily removes the selected entry, so it is revealed again when its directory arrives.
Confirmedβthe reset allows the reveal to retry after ancestors load. Thanks!