diff --git a/src/components/layout/header/internal/Activity.tsx b/src/components/layout/header/internal/Activity.tsx
index 00792e32f3..61400c62c5 100644
--- a/src/components/layout/header/internal/Activity.tsx
+++ b/src/components/layout/header/internal/Activity.tsx
@@ -14,6 +14,7 @@ import {
import { FloatPopover } from '~/components/ui/float-popover'
import { softBouncePrest } from '~/constants/spring'
import useDebounceValue from '~/hooks/common/use-debounce-value'
+import { usePageIsActive } from '~/hooks/common/use-is-active'
import { apiClient } from '~/lib/request'
import { useAggregationSelector } from '~/providers/root/aggregation-data-provider'
@@ -70,6 +71,7 @@ export const Activity = memo(() => {
const activity = useActivity()
+ const isPageActive = usePageIsActive()
const { data } = useQuery(
['activity'],
async () => {
@@ -83,7 +85,7 @@ export const Activity = memo(() => {
}>()
.then((res) => res)
.catch((err: RequestError) => {
- err.status === 404 && setIsEnabled(false)
+ setIsEnabled(false)
return { processName: '', mediaInfo: undefined }
})
},
@@ -91,7 +93,7 @@ export const Activity = memo(() => {
refetchInterval: 1000 * 5 * 60,
refetchOnMount: 'always',
retry: false,
- enabled: isEnabled,
+ enabled: isEnabled && isPageActive,
meta: {
persist: false,
},
@@ -134,40 +136,42 @@ export const Activity = memo(() => {
)}
-
- {!!appLabels[processName] && (
-
-
+ {!!appLabels[processName] && (
+
- {ownerName} 正在使用 {processName}
- {appDescrption[processName]
- ? ` ${appDescrption[processName]}`
- : ''}
-
-
- )}
-
+
+ {ownerName} 正在使用 {processName}
+ {appDescrption[processName]
+ ? ` ${appDescrption[processName]}`
+ : ''}
+
+
+ )}
+
+ )}
>
)
})