fix(m1): wrap onMounted drain in try/catch so listen is always set up

This commit is contained in:
pyr0ball 2026-05-18 18:51:56 -07:00
parent 8195ad98b0
commit db3694d9cf

View file

@ -46,13 +46,16 @@ const messagesEl = ref<HTMLElement | null>(null)
let unlisten: UnlistenFn | null = null
onMounted(async () => {
// Drain any events that fired while the panel was closed
const pending = await invoke<RobinEvent[]>('get_pending_events')
for (const e of pending) {
pushRobinEvent(e)
try {
const pending = await invoke<RobinEvent[]>('get_pending_events')
for (const e of pending) {
pushRobinEvent(e)
}
} catch (err) {
console.warn('Robin: failed to drain pending events:', err)
}
// Listen for live events while panel is open
// Always set up the live listener, even if drain failed
unlisten = await listen<RobinEvent>('robin:event', ({ payload }) => {
pushRobinEvent(payload)
})