fix: use selected proxy after profile changed

This commit is contained in:
GyDi
2023-01-15 21:33:03 +08:00
parent 9fee228d1a
commit 9249059cb7
5 changed files with 60 additions and 69 deletions

View File

@@ -1,7 +1,6 @@
import { useCallback, useEffect, useState } from "react";
import { useRecoilValue } from "recoil";
import { atomCurrentProfile } from "@/services/states";
import { ProxySortType } from "./use-filter-sort";
import { useProfiles } from "@/hooks/use-profiles";
export interface HeadState {
open?: boolean;
@@ -25,7 +24,8 @@ export const DEFAULT_STATE: HeadState = {
};
export function useHeadStateNew() {
const current = useRecoilValue(atomCurrentProfile);
const { profiles } = useProfiles();
const current = profiles?.current || "";
const [state, setState] = useState<Record<string, HeadState>>({});