diff --git a/services/web/frontend/js/features/ide-redesign/components/breadcrumbs.tsx b/services/web/frontend/js/features/ide-redesign/components/breadcrumbs.tsx index 455df85d7f..f148e0142e 100644 --- a/services/web/frontend/js/features/ide-redesign/components/breadcrumbs.tsx +++ b/services/web/frontend/js/features/ide-redesign/components/breadcrumbs.tsx @@ -50,6 +50,15 @@ export default function Breadcrumbs() { }) }, [openEntity, fileTreeData]) + const fileName = useMemo(() => { + // NOTE: openEntity.entity.name may not always be accurate, so we read it + // from the file tree data instead. + if (!openEntity || !fileTreeData) { + return undefined + } + return findInTreeOrThrow(fileTreeData, openEntity.entity._id)?.entity.name + }, [fileTreeData, openEntity]) + const outlineHierarchy = useMemo(() => { if (!canShowOutline || !outline) { return [] @@ -73,7 +82,7 @@ export default function Breadcrumbs() { ))} -
{openEntity.entity.name}
+
{fileName}
{numOutlineItems > 0 && } {outlineHierarchy.map((section, idx) => (