fix(breadcrumb): simplify breadcrumb logic and fix issue with shared items
This commit is contained in:
@@ -79,13 +79,12 @@ async function rebuildBreadCrumb() {
|
|||||||
currentFolderInfo = folderInfo;
|
currentFolderInfo = folderInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXX do not enter root into bread crumb updateBreadcrumb() method always display it
|
// Add every folder to the breadcrumb, including the root (home folder).
|
||||||
if (!folderInfo.is_root) {
|
// updateBreadcrumb() no longer auto-prepends home — it's our responsibility here.
|
||||||
app.breadcrumbPath.unshift({
|
app.breadcrumbPath.unshift({
|
||||||
id: folderInfo.id,
|
id: folderInfo.id,
|
||||||
name: folderInfo.name
|
name: folderInfo.name
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
// iterate to parent folder
|
// iterate to parent folder
|
||||||
id = folderInfo.parent_id;
|
id = folderInfo.parent_id;
|
||||||
|
|||||||
+4
-11
@@ -574,18 +574,11 @@ const ui = {
|
|||||||
}
|
}
|
||||||
breadcrumb?.appendChild(homeIcon);
|
breadcrumb?.appendChild(homeIcon);
|
||||||
|
|
||||||
// -- Root/Home folder name (if available) is always the first element of the breadcrumb --
|
|
||||||
// TODO clarify the difference between homeIcon & this first element
|
|
||||||
if (app.userHomeFolderName) {
|
|
||||||
if (path.length === 0 || path[0].id !== app.userHomeFolderId) {
|
|
||||||
path.unshift({
|
|
||||||
name: app.userHomeFolderName,
|
|
||||||
id: app.userHomeFolderId
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// -- Root/Home + Intermediate + current segments --
|
// -- Root/Home + Intermediate + current segments --
|
||||||
|
// NOTE: The home folder entry is added by rebuildBreadCrumb() (filesView.js) when it
|
||||||
|
// reaches the root folder during traversal. updateBreadcrumb() just renders app.breadcrumbPath
|
||||||
|
// as-is — no implicit mutation. This allows shared-folder navigation to show only the
|
||||||
|
// reachable subtree without the home prefix leaking in.
|
||||||
path.forEach((segment, index) => {
|
path.forEach((segment, index) => {
|
||||||
const isLast = index === path.length - 1;
|
const isLast = index === path.length - 1;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user