mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-11-08 02:52:07 +08:00
fix(rules): refresh once per visibility trigger
The mount effect fired refreshRules and refreshRuleProviders unconditionally and again under the page-visible flag, double-firing both queries on mount and on every hide-to-show transition. Gate the refresh on visibility once so each trigger performs exactly one revalidation.
This commit is contained in:
+1
-4
@@ -24,11 +24,8 @@ const RulesPage = () => {
|
||||
const [showScrollTop, setShowScrollTop] = useState(false)
|
||||
const pageVisible = useVisibility()
|
||||
|
||||
// 在组件挂载时和页面获得焦点时刷新规则数据
|
||||
// 页面可见时刷新规则数据:挂载时可见或从隐藏恢复可见各触发一次
|
||||
useEffect(() => {
|
||||
refreshRules()
|
||||
refreshRuleProviders()
|
||||
|
||||
if (pageVisible) {
|
||||
refreshRules()
|
||||
refreshRuleProviders()
|
||||
|
||||
Reference in New Issue
Block a user