fix current directory not updating when modifying stuff

This commit is contained in:
2025-07-18 15:01:38 +02:00
parent 48cbd532c2
commit ec8e73507c
4 changed files with 29 additions and 18 deletions

View File

@@ -1,9 +1,7 @@
<script setup lang="ts">
import { computedAsync } from '@vueuse/core';
import DirectoryListContextMenu from '~/components/DirectoryListContextMenu.vue';
import RenameEntryDialog from '~/components/actions/RenameEntryDialog.vue';
import { getWarrenDirectory } from '~/lib/api/warrens';
import type { DirectoryEntry } from '~/types';
definePageMeta({
middleware: ['authenticated'],
@@ -11,6 +9,7 @@ definePageMeta({
const warrenStore = useWarrenStore();
const loadingIndicator = useLoadingIndicator();
const warrenPath = computed(() => useWarrenPath());
if (warrenStore.current == null) {
await navigateTo({
@@ -18,24 +17,28 @@ if (warrenStore.current == null) {
});
}
const entries = computedAsync<DirectoryEntry[]>(async () => {
if (warrenStore.current == null) {
return [];
}
const entries = useAsyncData(
'current-directory',
async () => {
if (warrenStore.current == null) {
return [];
}
loadingIndicator.start();
warrenStore.loading = true;
loadingIndicator.start();
warrenStore.loading = true;
const entries = await getWarrenDirectory(
warrenStore.current.warrenId,
warrenStore.current.path
);
const entries = await getWarrenDirectory(
warrenStore.current.warrenId,
warrenStore.current.path
);
warrenStore.loading = false;
loadingIndicator.finish();
warrenStore.loading = false;
loadingIndicator.finish();
return entries;
}, []);
return entries;
},
{ watch: [warrenPath] }
).data;
</script>
<template>