mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-31 04:41:32 +02:00
Merge pull request #25984 from overleaf/mj-breadcrumbs-filename-refresh
[web] Update breadcrumbs file name on renames GitOrigin-RevId: 8d2f176b14880bec512a9b37c15148e10f29a758
This commit is contained in:
committed by
Copybot
parent
8df787ae0d
commit
615d5cdda4
@@ -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() {
|
||||
</Fragment>
|
||||
))}
|
||||
<MaterialIcon unfilled type="description" />
|
||||
<div>{openEntity.entity.name}</div>
|
||||
<div>{fileName}</div>
|
||||
{numOutlineItems > 0 && <Chevron />}
|
||||
{outlineHierarchy.map((section, idx) => (
|
||||
<Fragment key={section.line}>
|
||||
|
||||
Reference in New Issue
Block a user