Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): folder links from chat open the file tree instead of a broken preview #10909

Mergedpc-style(GitHub profile, opens in a new tab)merged 16 commits intomain fromrefs/pull/10909/headmerged by Yash-Singh1(GitHub profile, opens in a new tab) View on GitHub

Showing 6 changed files with 103 additions and 28 deletions (loading 3).

x
0 of 6 viewed, 6 left
13 additions and 4 deletionsapps/web/src/components/files/FileBrowserPanel.tsxModified
View file
@@ -31,7 +31,7 @@
environmentId: EnvironmentId;
cwd: string;
projectName: string;
- /** File currently open in the preview pane; revealed and selected in the tree. */
+ /** Entry currently open in the surface; revealed and selected in the tree. A directory is expanded. */
selectedPath: string | null;
/** Bumped when the same path should be revealed again (e.g. re-opened from search). */
selectedPathRevealId: number;
@@ -376,7 +376,10 @@
handledRevealRef.current = null;
return;
- if (entryKinds.get(selectedPath) !== "file") {
+ const selectedKind = entryKinds.get(selectedPath);
+ // An unloaded entry has no row to reveal yet; folders do, and chat links can
+ // point at them.
+ if (selectedKind === undefined) {
handledRevealRef.current = null;
return;
@@ -390,7 +393,9 @@
) {
return;
- const selectedItem = model.getItem(selectedPath);
+ // Directory rows are registered with a trailing slash (see treePath).
+ const selectedTreePath = selectedKind === "directory" ? `${selectedPath}/` : selectedPath;