revalidateOnFocus
revalidateOnFocus is a configuration option commonly found in data fetching libraries, particularly those designed for client-side applications such as React Query or SWR. Its purpose is to automatically trigger a re-fetch of data when the browser window or tab regains focus. This mechanism helps ensure that the data displayed to the user is as up-to-date as possible without requiring manual user intervention.
When a user switches away from a web page and then returns, or if the browser tab
The behavior of revalidateOnFocus can often be controlled through configuration. Developers can choose to enable or