fix(file): Fix issue with abnormal display when calculating sizes of multiple folders simultaneously (#8065)

This commit is contained in:
zhengkunwang 2025-03-05 14:20:05 +08:00 committed by GitHub
parent 7a6e5376c4
commit 4b1154209b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -256,7 +256,7 @@
link link
small small
@click="getDirSize(row, $index)" @click="getDirSize(row, $index)"
:loading="btnLoading == $index" :loading="row.btnLoading"
> >
<span v-if="row.dirSize == undefined"> <span v-if="row.dirSize == undefined">
{{ $t('file.calculate') }} {{ $t('file.calculate') }}
@ -377,7 +377,6 @@ const initData = () => ({
}); });
let req = reactive(initData()); let req = reactive(initData());
let loading = ref(false); let loading = ref(false);
let btnLoading = ref(-1);
const paths = ref<FilePaths[]>([]); const paths = ref<FilePaths[]>([]);
let pathWidth = ref(0); let pathWidth = ref(0);
const history: string[] = []; const history: string[] = [];
@ -419,7 +418,6 @@ const dialogVscodeOpenRef = ref();
const previewRef = ref(); const previewRef = ref();
const processRef = ref(); const processRef = ref();
// editablePath
const { searchableStatus, searchablePath, searchableInputRef, searchableInputBlur } = useSearchable(paths); const { searchableStatus, searchablePath, searchableInputRef, searchableInputBlur } = useSearchable(paths);
const paginationConfig = reactive({ const paginationConfig = reactive({
@ -453,7 +451,6 @@ const search = async () => {
}); });
}; };
/** just search, no handleSearchResult */
const searchFile = async () => { const searchFile = async () => {
loading.value = true; loading.value = true;
try { try {
@ -548,7 +545,6 @@ const jump = async (url: string) => {
const { path: oldUrl, pageSize: oldPageSize } = req; const { path: oldUrl, pageSize: oldPageSize } = req;
Object.assign(req, initData(), { path: url, containSub: false, search: '', pageSize: oldPageSize }); Object.assign(req, initData(), { path: url, containSub: false, search: '', pageSize: oldPageSize });
let searchResult = await searchFile(); let searchResult = await searchFile();
// check search result,the file is exists?
if (!searchResult.data.path) { if (!searchResult.data.path) {
req.path = oldUrl; req.path = oldUrl;
globalStore.setLastFilePath(req.path); globalStore.setLastFilePath(req.path);
@ -566,7 +562,6 @@ const jump = async (url: string) => {
const backForwardJump = async (url: string) => { const backForwardJump = async (url: string) => {
const oldPageSize = req.pageSize; const oldPageSize = req.pageSize;
// reset search params before exec jump
Object.assign(req, initData()); Object.assign(req, initData());
req.path = url; req.path = url;
req.containSub = false; req.containSub = false;
@ -624,7 +619,7 @@ const getDirSize = async (row: any, index: number) => {
const req = { const req = {
path: row.path, path: row.path,
}; };
btnLoading.value = index; data.value[index].btnLoading = true;
await computeDirSize(req) await computeDirSize(req)
.then(async (res) => { .then(async (res) => {
let newData = [...data.value]; let newData = [...data.value];
@ -632,7 +627,7 @@ const getDirSize = async (row: any, index: number) => {
data.value = newData; data.value = newData;
}) })
.finally(() => { .finally(() => {
btnLoading.value = -1; data.value[index].btnLoading = false;
}); });
}; };