diff --git a/app/src/resources/__tests__/useNotifyService.test.ts b/app/src/resources/__tests__/useNotifyService.test.ts index 11b3afcb93d..f2bf6bb516f 100644 --- a/app/src/resources/__tests__/useNotifyService.test.ts +++ b/app/src/resources/__tests__/useNotifyService.test.ts @@ -47,7 +47,7 @@ describe('useNotifyService', () => { vi.clearAllMocks() }) - it('should trigger a subscribe action on a successful initial mount', () => { + it('should trigger an HTTP refetch and subscribe action on a successful initial mount', () => { renderHook(() => useNotifyService({ topic: MOCK_TOPIC, @@ -55,6 +55,7 @@ describe('useNotifyService', () => { options: MOCK_OPTIONS, } as any) ) + expect(mockHTTPRefetch).toHaveBeenCalledWith('once') expect(mockDispatch).toHaveBeenCalledWith( notifySubscribeAction(MOCK_HOST_CONFIG.hostname, MOCK_TOPIC) ) diff --git a/app/src/resources/useNotifyService.ts b/app/src/resources/useNotifyService.ts index 022ce0407b7..619b797e527 100644 --- a/app/src/resources/useNotifyService.ts +++ b/app/src/resources/useNotifyService.ts @@ -51,6 +51,8 @@ export function useNotifyService({ React.useEffect(() => { if (shouldUseNotifications) { + // Always fetch on initial mount to keep latency as low as possible. + setRefetch('once') appShellListener({ hostname, topic,