fix: move other (clock+place) live icon to top ehader too
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { computed, onBeforeUnmount, onMounted, ref } from 'vue'
|
||||
import { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'
|
||||
import { useWebSocket } from '@vueuse/core'
|
||||
import { placeApiCanvas } from '@/api'
|
||||
|
||||
@@ -108,6 +108,15 @@ export function usePlaceSocket(eventPath: string, onPixel?: OnPixel, onResize?:
|
||||
|
||||
const connected = computed(() => status.value === 'OPEN')
|
||||
|
||||
// Pixels placed while disconnected never reach us: catch up by reloading
|
||||
// the whole canvas on every reconnect (the first load is done on mount).
|
||||
let hasConnected = false
|
||||
watch(connected, (isConnected) => {
|
||||
if (!isConnected) return
|
||||
if (hasConnected) loadCanvas()
|
||||
hasConnected = true
|
||||
})
|
||||
|
||||
async function loadCanvas() {
|
||||
const response = await placeApiCanvas({ path: { event_path: eventPath } })
|
||||
if (!response.data) return
|
||||
|
||||
Reference in New Issue
Block a user