diff --git a/frontend/src/components/BreadCrumb.vue b/frontend/src/components/BreadCrumb.vue index ad6288e..c35f669 100644 --- a/frontend/src/components/BreadCrumb.vue +++ b/frontend/src/components/BreadCrumb.vue @@ -34,6 +34,7 @@ import home from '@/assets/svg/home.svg' import { nextTick, onBeforeUpdate, ref, watchEffect } from 'vue' import { useRouter } from 'vue-router' +import { exists } from '@/utils/fileutil' const router = useRouter() @@ -86,6 +87,15 @@ watchEffect(() => { else if (props.path.length > longcut.length) { longest.value = longcut.concat(props.path.slice(longcut.length)) } + else { + // Prune deleted folders from longest + for (let i = props.path.length; i < longest.value.length; ++i) { + if (!exists(longest.value.slice(0, i + 1))) { + longest.value = longest.value.slice(0, i) + break + } + } + } // If needed, focus primary navigation to new location if (props.primary) nextTick(() => { const act = document.activeElement as HTMLElement diff --git a/frontend/src/components/EmptyFolder.vue b/frontend/src/components/EmptyFolder.vue index 4313f8a..8134a56 100644 --- a/frontend/src/components/EmptyFolder.vue +++ b/frontend/src/components/EmptyFolder.vue @@ -4,7 +4,7 @@
No Connection
Waiting for File List
No matches!
-Folder not found
+Folder not found
Empty folder
@@ -13,6 +13,7 @@ import { defineProps } from 'vue' import { useMainStore } from '@/stores/main' import cog from '@/assets/svg/cog.svg' +import { exists } from '@/utils/fileutil' const store = useMainStore() const props = defineProps<{ diff --git a/frontend/src/utils/fileutil.ts b/frontend/src/utils/fileutil.ts new file mode 100644 index 0000000..183f5aa --- /dev/null +++ b/frontend/src/utils/fileutil.ts @@ -0,0 +1,5 @@ +import { useMainStore } from '@/stores/main' + +const store = useMainStore() + +export const exists = (path: string[]) => store.document.some(doc => (doc.loc ? `${doc.loc}/${doc.name}` : doc.name) === path.join('/'))