Merge pull request #95 from madhura68/fix/idea-timeline-auto-refresh

fix(m12): IdeaTimeline auto-refresh on new idea-questions
This commit is contained in:
Janpeter Visser 2026-05-05 13:45:18 +02:00 committed by GitHub
commit 96bda7da00
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -11,6 +11,7 @@
'use client'
import { useEffect, useRef } from 'react'
import { useRouter } from 'next/navigation'
import { useNotificationsStore, type NotificationQuestion } from '@/stores/notifications-store'
import { useIdeaStore } from '@/stores/idea-store'
@ -66,6 +67,7 @@ export function useNotificationsRealtime() {
const sourceRef = useRef<EventSource | null>(null)
const backoffRef = useRef<number>(BACKOFF_START_MS)
const reconnectTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null)
const router = useRouter()
useEffect(() => {
const init = useNotificationsStore.getState().init
@ -146,6 +148,11 @@ export function useNotificationsRealtime() {
} else {
remove(payload.id)
}
// M12 hotfix: refresh de current page (server-component) zodat de
// IdeaTimeline-tab op /ideas/[id] de nieuwe vraag oppikt zonder
// dat de gebruiker handmatig moet refreshen. Geen-op als de
// gebruiker elders zit; goedkoop genoeg om altijd te triggeren.
router.refresh()
return
}