mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-11-23 04:42:08 +08:00
revert: use-app-data (#6088)
* Revert "refactor(app-data): split monolithic context into focused SWR hooks (#5576)"
This reverts commit 8e8182f707.
# Conflicts:
# src/components/home/clash-info-card.tsx
# src/components/home/clash-mode-card.tsx
# src/components/home/current-proxy-card.tsx
# src/components/home/home-profile-card.tsx
# src/components/proxy/provider-button.tsx
# src/components/proxy/proxy-chain.tsx
# src/components/proxy/proxy-groups.tsx
# src/components/proxy/use-render-list.ts
# src/components/rule/provider-button.tsx
# src/components/setting/mods/sysproxy-viewer.tsx
# src/hooks/use-clash-data.ts
# src/hooks/use-current-proxy.ts
# src/hooks/use-shared-swr-poller.ts
# src/hooks/use-system-proxy-state.ts
# src/pages/rules.tsx
* docs: Changelog.md
This commit is contained in:
@@ -21,10 +21,7 @@ import { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { updateRuleProvider } from "tauri-plugin-mihomo-api";
|
||||
|
||||
import type {
|
||||
useRuleProvidersData,
|
||||
useRulesData,
|
||||
} from "@/hooks/use-clash-data";
|
||||
import { useAppData } from "@/providers/app-data-context";
|
||||
import { showNotice } from "@/services/notice-service";
|
||||
|
||||
// 辅助组件 - 类型框
|
||||
@@ -40,22 +37,10 @@ const TypeBox = styled(Box)<{ component?: React.ElementType }>(({ theme }) => ({
|
||||
lineHeight: 1.25,
|
||||
}));
|
||||
|
||||
type RuleProvidersHook = ReturnType<typeof useRuleProvidersData>;
|
||||
type RulesHook = ReturnType<typeof useRulesData>;
|
||||
|
||||
interface ProviderButtonProps {
|
||||
ruleProviders: RuleProvidersHook["ruleProviders"];
|
||||
refreshRuleProviders: RuleProvidersHook["refreshRuleProviders"];
|
||||
refreshRules: RulesHook["refreshRules"];
|
||||
}
|
||||
|
||||
export const ProviderButton = ({
|
||||
ruleProviders,
|
||||
refreshRuleProviders,
|
||||
refreshRules,
|
||||
}: ProviderButtonProps) => {
|
||||
export const ProviderButton = () => {
|
||||
const { t } = useTranslation();
|
||||
const [open, setOpen] = useState(false);
|
||||
const { ruleProviders, refreshRules, refreshRuleProviders } = useAppData();
|
||||
const [updating, setUpdating] = useState<Record<string, boolean>>({});
|
||||
|
||||
// 检查是否有提供者
|
||||
@@ -178,8 +163,8 @@ export const ProviderButton = ({
|
||||
<List sx={{ py: 0, minHeight: 250 }}>
|
||||
{Object.entries(ruleProviders || {})
|
||||
.sort()
|
||||
.map(([key, provider]) => {
|
||||
if (!provider) return null;
|
||||
.map(([key, item]) => {
|
||||
const provider = item;
|
||||
const time = dayjs(provider.updatedAt);
|
||||
const isUpdating = updating[key];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user