Skip to content
Discussion options

You must be logged in to vote

The gap here is between browser timer APIs and OS-level suspend/resume. refetchInterval uses setInterval under the hood, and when the OS suspends, the JS event loop freezes. On resume, setInterval doesn't retroactively fire for missed ticks. And refetchOnWindowFocus relies on visibilitychange, which never fires for a tray app that was never "hidden."

The cleanest fix for Electron: use powerMonitor.on('resume') in the main process, IPC it to the renderer, and call queryClient.refetchQueries({ type: 'active' }). That's the OS-level truth; no heuristics, no drift detection.

// main process
powerMonitor.on('resume', () => {
  BrowserWindow.getAllWindows().forEach(win => win.webContents.send('…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@setchy
Comment options

Answer selected by setchy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants