mirror of
https://github.com/lukaszraczylo/claude-mnemonic.git
synced 2026-06-23 03:51:31 +00:00
Improvements to the queue processing.
This commit is contained in:
@@ -1,12 +1,16 @@
|
||||
import { ref, onMounted, onUnmounted } from 'vue'
|
||||
import { ref, onMounted, onUnmounted, watch } from 'vue'
|
||||
import type { Stats } from '@/types'
|
||||
import { fetchStats } from '@/utils/api'
|
||||
import { useSSE } from './useSSE'
|
||||
|
||||
export function useStats(pollInterval: number = 5000) {
|
||||
const stats = ref<Stats | null>(null)
|
||||
const loading = ref(false)
|
||||
const error = ref<string | null>(null)
|
||||
|
||||
// SSE for real-time session updates
|
||||
const { lastEvent } = useSSE()
|
||||
|
||||
let intervalId: number | null = null
|
||||
|
||||
const refresh = async () => {
|
||||
@@ -35,6 +39,14 @@ export function useStats(pollInterval: number = 5000) {
|
||||
}
|
||||
}
|
||||
|
||||
// Watch for SSE session events and refresh immediately
|
||||
watch(lastEvent, (event) => {
|
||||
if (event && event.type === 'session') {
|
||||
console.log('[Stats] SSE session event triggered refresh:', event.action)
|
||||
refresh()
|
||||
}
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
refresh()
|
||||
startPolling()
|
||||
|
||||
Reference in New Issue
Block a user