Only update time-ago modified field on current folder (optimization, full update was slow for large storages).
This commit is contained in:
		| @@ -44,8 +44,6 @@ watchEffect(() => { | |||||||
| onMounted(loadSession) | onMounted(loadSession) | ||||||
| onMounted(watchConnect) | onMounted(watchConnect) | ||||||
| onUnmounted(watchDisconnect) | onUnmounted(watchDisconnect) | ||||||
| // Update human-readable x seconds ago messages from mtimes |  | ||||||
| setInterval(documentStore.updateModified, 1000) |  | ||||||
| const headerMain = ref<typeof HeaderMain | null>(null) | const headerMain = ref<typeof HeaderMain | null>(null) | ||||||
| let vert = 0 | let vert = 0 | ||||||
| let timer: any = null | let timer: any = null | ||||||
|   | |||||||
| @@ -79,7 +79,7 @@ | |||||||
| </template> | </template> | ||||||
|  |  | ||||||
| <script setup lang="ts"> | <script setup lang="ts"> | ||||||
| import { ref, computed, watchEffect } from 'vue' | import { ref, computed, watchEffect, onMounted, onUnmounted } from 'vue' | ||||||
| import { useDocumentStore } from '@/stores/documents' | import { useDocumentStore } from '@/stores/documents' | ||||||
| import type { Document } from '@/repositories/Document' | import type { Document } from '@/repositories/Document' | ||||||
| import FileRenameInput from './FileRenameInput.vue' | import FileRenameInput from './FileRenameInput.vue' | ||||||
| @@ -229,6 +229,13 @@ watchEffect(() => { | |||||||
|     focusBreadcrumb() |     focusBreadcrumb() | ||||||
|   } |   } | ||||||
| }) | }) | ||||||
|  | // Update human-readable x seconds ago messages from mtimes | ||||||
|  | let modifiedTimer: any = null | ||||||
|  | const updateModified = () => { | ||||||
|  |   for (const doc of props.documents) doc.modified = formatUnixDate(doc.mtime) | ||||||
|  | } | ||||||
|  | onMounted(() => { modifiedTimer = setInterval(updateModified, 1000) }) | ||||||
|  | onUnmounted(() => { clearInterval(modifiedTimer) }) | ||||||
| const mkdir = (doc: Document, name: string) => { | const mkdir = (doc: Document, name: string) => { | ||||||
|   const control = connect(controlUrl, { |   const control = connect(controlUrl, { | ||||||
|     open() { |     open() { | ||||||
|   | |||||||
| @@ -53,9 +53,6 @@ export const useDocumentStore = defineStore({ | |||||||
|       } |       } | ||||||
|       this.document = docs as Document[] |       this.document = docs as Document[] | ||||||
|     }, |     }, | ||||||
|     updateModified() { |  | ||||||
|       for (const doc of this.document) doc.modified = formatUnixDate(doc.mtime) |  | ||||||
|     }, |  | ||||||
|     login(username: string, privileged: boolean) { |     login(username: string, privileged: boolean) { | ||||||
|       this.user.username = username |       this.user.username = username | ||||||
|       this.user.privileged = privileged |       this.user.privileged = privileged | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Leo Vasanko
					Leo Vasanko