mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-01-28 07:14:40 +08:00
fix: head state not updated when using config.yaml as current profile (#5827)
This commit is contained in:
@@ -55,11 +55,6 @@ export function useHeadStateNew() {
|
||||
const [state, dispatch] = useReducer(headStateReducer, {});
|
||||
|
||||
useEffect(() => {
|
||||
if (!current) {
|
||||
dispatch({ type: "reset" });
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const data = JSON.parse(
|
||||
localStorage.getItem(HEAD_STATE_KEY)!,
|
||||
@@ -78,8 +73,6 @@ export function useHeadStateNew() {
|
||||
}, [current]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!current) return;
|
||||
|
||||
const timer = setTimeout(() => {
|
||||
try {
|
||||
const item = localStorage.getItem(HEAD_STATE_KEY);
|
||||
@@ -99,10 +92,9 @@ export function useHeadStateNew() {
|
||||
|
||||
const setHeadState = useCallback(
|
||||
(groupName: string, obj: Partial<HeadState>) => {
|
||||
if (!current) return;
|
||||
dispatch({ type: "update", groupName, patch: obj });
|
||||
},
|
||||
[current],
|
||||
[],
|
||||
);
|
||||
|
||||
return [state, setHeadState] as const;
|
||||
|
||||
Reference in New Issue
Block a user