fix: revalidate changelog on tab visibility change (#8532)

* fix: added changes for revalidation changelog on tab change

* chore: removed four hours diff change
This commit is contained in:
Abhi kumar 2025-07-15 15:17:14 +05:30 committed by GitHub
parent 5e0bf930d6
commit 53b71d7062
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -27,6 +27,7 @@ import dayjs from 'dayjs';
import { useIsDarkMode } from 'hooks/useDarkMode';
import { useGetTenantLicense } from 'hooks/useGetTenantLicense';
import { useNotifications } from 'hooks/useNotifications';
import useTabVisibility from 'hooks/useTabFocus';
import history from 'lib/history';
import { isNull } from 'lodash-es';
import ErrorBoundaryFallback from 'pages/ErrorBoundaryFallback/ErrorBoundaryFallback';
@ -154,6 +155,8 @@ function AppLayout(props: AppLayoutProps): JSX.Element {
preference.name === USER_PREFERENCES.LAST_SEEN_CHANGELOG_VERSION,
)?.value as string;
const isVisible = useTabVisibility();
const [
getUserVersionResponse,
getUserLatestVersionResponse,
@ -177,6 +180,13 @@ function AppLayout(props: AppLayoutProps): JSX.Element {
},
]);
useEffect(() => {
// refetch the changelog only when the current tab becomes active + there isn't an active request + no changelog already available
if (!changelog && !getChangelogByVersionResponse.isLoading && isVisible) {
getChangelogByVersionResponse.refetch();
}
}, [isVisible, changelog, getChangelogByVersionResponse]);
useEffect(() => {
let timer: ReturnType<typeof setTimeout>;
if (