1
0
forked from noxious/client

Hot reload for objects when updated inside asset manager so no page reload is required

This commit is contained in:
2024-07-06 22:24:29 +02:00
parent e96b9c9ee9
commit 067478055e
6 changed files with 53 additions and 15 deletions

View File

@ -29,11 +29,14 @@
import type { Object } from '@/types'
import { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'
import { useAssetManagerStore } from '@/stores/assetManager'
import { useZoneEditorStore } from '@/stores/zoneEditor'
import { useSocketStore } from '@/stores/socket'
import config from '@/config'
const socket = useSocketStore()
const assetManagerStore = useAssetManagerStore()
const zoneEditorStore = useZoneEditorStore()
const selectedObject = computed(() => assetManagerStore.selectedObject)
const objectName = ref('')
@ -71,6 +74,11 @@ function refreshObjectList() {
socket.connection.emit('gm:object:list', {}, (response: Object[]) => {
assetManagerStore.setObjectList(response)
assetManagerStore.setSelectedObject(null)
if (zoneEditorStore.active) {
console.log('Refreshing object list for zone store')
zoneEditorStore.setObjectList(response)
}
})
}