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:
commit
96bda7da00
1 changed files with 7 additions and 0 deletions
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue