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

@@ -61,7 +61,7 @@ async function onClick() {
<ContextMenu>
<ContextMenuTrigger>
<button
:disabled="warrenStore.loading"
:disabled="warrenStore.loading || disabled"
:class="[
'bg-accent/30 border-border flex w-52 flex-row gap-4 overflow-hidden rounded-md border-1 px-4 py-2 select-none',
{

View File

@@ -0,0 +1,9 @@
export function useWarrenPath() {
const store = useWarrenStore();
if (store.current == null) {
return null;
}
return `${store.current.warrenId}/${store.current.path}`;
}

View File

@@ -1,6 +1,5 @@
import { toast } from 'vue-sonner';
import type { ApiResponse } from '~/types/api';
import { getAuthSessionData } from './getSession';
import type { AuthUser } from '~/types/auth';
export async function loginUser(

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,7 +17,9 @@ if (warrenStore.current == null) {
});
}
const entries = computedAsync<DirectoryEntry[]>(async () => {
const entries = useAsyncData(
'current-directory',
async () => {
if (warrenStore.current == null) {
return [];
}
@@ -35,7 +36,9 @@ const entries = computedAsync<DirectoryEntry[]>(async () => {
loadingIndicator.finish();
return entries;
}, []);
},
{ watch: [warrenPath] }
).data;
</script>
<template>