@devries-cameron20 / t3code-1 / commits / ec9f8e875c
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

perf(web): file breadcrumbs compile with the React Compiler (#20651)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Julius Marminge committed Oct 16, 2026 at 21:57 UTC ec9f8e875ca01abcff45cc3cdc8c89f24130af5a
1 file changed +11 -12
apps/web/src/components/files/FileBreadcrumbs.tsx
+11 -12
@@ -2,7 +2,7 @@ import { RefreshIcon } from "~/components/ui/refresh-icon";
2 import { Spinner } from "~/components/ui/spinner";
3 import type { EnvironmentId } from "@t3tools/contracts";
4 import { ArrowLeftIcon, ChevronRightIcon } from "lucide-react";
5 -import { useEffect, useMemo, useState } from "react";
5 +import { useState } from "react";
6
7 import { PierreEntryIcon } from "~/components/chat/PierreEntryIcon";
8 import {
@@ -94,10 +94,7 @@ function BreadcrumbMenuContent(props: {
94 const { resolvedTheme } = useTheme();
95 const entries = entriesQuery.data?.entries ?? [];
96 const entriesTruncated = entriesQuery.data?.truncated ?? false;
97 - const children = useMemo(
98 - () => fileBreadcrumbChildren(entries, props.directoryPath),
99 - [entries, props.directoryPath],
100 - );
97 + const children = fileBreadcrumbChildren(entries, props.directoryPath);
98 const directoryAvailable = entriesQuery.data !== null;
99 const parentPath = fileBreadcrumbParent(props.directoryPath);
100 const canGoBack =
@@ -222,11 +219,16 @@ function BreadcrumbMenuContent(props: {
219 function FolderContentsMenu(props: FileBreadcrumbsProps & { readonly crumb: FileBreadcrumb }) {
220 const [open, setOpen] = useState(false);
221 const [directoryPath, setDirectoryPath] = useState(props.crumb.path);
225 -
226 - useEffect(() => {
222 + // Opening another file or moving the crumb closes the menu and returns it to the crumb's folder.
223 + const [shownFor, setShownFor] = useState({
224 + crumbPath: props.crumb.path,
225 + relativePath: props.relativePath,
226 + });
227 + if (shownFor.crumbPath !== props.crumb.path || shownFor.relativePath !== props.relativePath) {
228 + setShownFor({ crumbPath: props.crumb.path, relativePath: props.relativePath });
229 setOpen(false);
230 setDirectoryPath(props.crumb.path);
229 - }, [props.crumb.path, props.relativePath]);
231 + }
232
233 const handleOpenChange = (nextOpen: boolean) => {
234 setOpen(nextOpen);
@@ -299,10 +301,7 @@ function FolderBreadcrumb(props: {
301 */
302 export function FileBreadcrumbs(props: FileBreadcrumbsProps) {
303 const hostPath = isAbsolutePath(props.relativePath);
302 - const breadcrumbs = useMemo(
303 - () => fileBreadcrumbs(props.projectName, props.trail),
304 - [props.projectName, props.trail],
305 - );
304 + const breadcrumbs = fileBreadcrumbs(props.projectName, props.trail);
305 const currentPath = breadcrumbPathOf(props.relativePath);
306 const currentIndex = breadcrumbs.findIndex((crumb) => crumb.path === currentPath);
307