-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Hello everyone!
I’d appreciate some help with this strange issue, which I can’t seem to reproduce via chrome://discards either.
It’s likely that when the browser goes offline or becomes inactive for a while, it transitions the tab into a frozen or hidden state. In this state, JS processes are paused, and React’s rendering behavior may also change. As a result, I suppose, RTK Query may detect that there are no active subscribers to certain queries and automatically unsubscribes, which causes the cached data to be cleared.
When the user returns to the tab, the page isn’t reloaded (so the tab state isn’t discarded or terminated), meaning the Redux store remains alive — but the cache is already empty, leading to an empty UI render.
Current behavior:
- After resuming from system sleep or long inactivity, previously visible data disappears.
- No errors appear in the console or network tab.
- The page does not reload, but cached query data is gone.
- Navigating to another menu item or section forces a reload, after which data reappears.
Steps to reproduce:
- Open some page.
- Confirm that query data is visible.
- Put the computer to sleep (±20 minutes).
- Wake the computer.
- Without any further interaction, observe that the data disappears (no errors in requests or console).
Additional notes:
- The issue isn’t consistently reproducible.
- Might be related to how RTK Query handles inactive subscriptions during browser freeze/hidden states.