mirror of
https://github.com/SigNoz/signoz.git
synced 2025-12-17 15:36:48 +00:00
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:
parent
5e0bf930d6
commit
53b71d7062
@ -27,6 +27,7 @@ import dayjs from 'dayjs';
|
|||||||
import { useIsDarkMode } from 'hooks/useDarkMode';
|
import { useIsDarkMode } from 'hooks/useDarkMode';
|
||||||
import { useGetTenantLicense } from 'hooks/useGetTenantLicense';
|
import { useGetTenantLicense } from 'hooks/useGetTenantLicense';
|
||||||
import { useNotifications } from 'hooks/useNotifications';
|
import { useNotifications } from 'hooks/useNotifications';
|
||||||
|
import useTabVisibility from 'hooks/useTabFocus';
|
||||||
import history from 'lib/history';
|
import history from 'lib/history';
|
||||||
import { isNull } from 'lodash-es';
|
import { isNull } from 'lodash-es';
|
||||||
import ErrorBoundaryFallback from 'pages/ErrorBoundaryFallback/ErrorBoundaryFallback';
|
import ErrorBoundaryFallback from 'pages/ErrorBoundaryFallback/ErrorBoundaryFallback';
|
||||||
@ -154,6 +155,8 @@ function AppLayout(props: AppLayoutProps): JSX.Element {
|
|||||||
preference.name === USER_PREFERENCES.LAST_SEEN_CHANGELOG_VERSION,
|
preference.name === USER_PREFERENCES.LAST_SEEN_CHANGELOG_VERSION,
|
||||||
)?.value as string;
|
)?.value as string;
|
||||||
|
|
||||||
|
const isVisible = useTabVisibility();
|
||||||
|
|
||||||
const [
|
const [
|
||||||
getUserVersionResponse,
|
getUserVersionResponse,
|
||||||
getUserLatestVersionResponse,
|
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(() => {
|
useEffect(() => {
|
||||||
let timer: ReturnType<typeof setTimeout>;
|
let timer: ReturnType<typeof setTimeout>;
|
||||||
if (
|
if (
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user