Fix issue when reinstalled the DNS overwrite button may show a wrong status. (#3505)
This commit is contained in:
committed by
GitHub
Unverified
parent
29ae70bbf6
commit
ebc9fc5eba
@@ -51,10 +51,11 @@ const SettingClash = ({ onError }: Props) => {
|
||||
// 独立跟踪DNS设置开关状态
|
||||
const [dnsSettingsEnabled, setDnsSettingsEnabled] = useState(() => {
|
||||
// 尝试从localStorage获取之前保存的状态
|
||||
const savedState = localStorage.getItem("dns_settings_enabled");
|
||||
if (savedState !== null) {
|
||||
return savedState === "true";
|
||||
}
|
||||
// 如果重装(或删除数据更新)前开关处于关闭状态,重装后会获取到错误的状态
|
||||
// const savedState = localStorage.getItem("dns_settings_enabled");
|
||||
// if (savedState !== null) {
|
||||
// return savedState === "true";
|
||||
// }
|
||||
// 如果没有保存的状态,则从verge配置中获取
|
||||
return verge?.enable_dns_settings ?? false;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user