diff --git a/Services/client/src/stores/socket.ts b/Services/client/src/stores/socket.ts index 59d6692..92e2aab 100644 --- a/Services/client/src/stores/socket.ts +++ b/Services/client/src/stores/socket.ts @@ -1,6 +1,5 @@ import { defineStore } from 'pinia' import { reactive } from 'vue' -import { useFileInfoStore } from '@/stores/file-info-data' import { io } from 'socket.io-client' import { useTreeDataStore } from '@/stores/tree-data' import { storeToRefs } from 'pinia' @@ -53,15 +52,23 @@ export const useSocketStore = defineStore('socket', () => { }, ) - currentFolder.value.push({ - pathname: pathname, - name: pathArray[pathArray.length - 1], - status: true, - folder: [], - file: [], - }) + if ( + currentFolder.value.findIndex( + (v) => v.name === pathArray[pathArray.length - 1], + ) === -1 + ) { + currentFolder.value.push({ + pathname: pathname, + name: pathArray[pathArray.length - 1], + status: true, + folder: [], + file: [], + }) + } - listDataFolder.value = currentFolder.value + currentFolder.value.sort((a, b) => { + return a.name.localeCompare(b.name) + }) } })