11import api from "@/client/api" ;
22import { useAsyncState } from '@vueuse/core' ;
3- import { computed , ref } from 'vue' ;
3+ import { computed , nextTick , ref } from 'vue' ;
44import { debounce } from 'perfect-debounce' ;
55import { ConfigDto } from "@/client/apiGen" ;
66import { globalCapture , modInfo , updateModInfo } from "@/store/refs" ;
@@ -14,7 +14,7 @@ const skipSignatureCheckRef = ref(false);
1414export const configReadErr = ref ( '' ) ;
1515export const configReadErrTitle = ref ( '' ) ;
1616
17- // 标志位:配置刚从服务器加载,watcher 应忽略首次变更
17+ // 防止在 mod 管理页面,一加载就触发保存
1818export const configJustLoaded = ref ( false ) ;
1919
2020const { state : aquaMaiConfig , execute : executeGetConfig , isLoading : configLoading } = useAsyncState ( async ( ) => {
@@ -56,7 +56,7 @@ const { state: aquaMaiConfig, execute: executeGetConfig, isLoading: configLoadin
5656 forceDefaultRef . value = false ;
5757 skipSignatureCheckRef . value = false ;
5858 }
59- } , undefined as ConfigDto | undefined , { immediate : false , shallow : false } ) ;
59+ } , undefined as ConfigDto | undefined , { immediate : false , shallow : false , resetOnExecute : false } ) ;
6060
6161export { aquaMaiConfig , configLoading } ;
6262
@@ -65,6 +65,8 @@ export const updateAquaMaiConfig = async (forceDefault = false, skipSignatureChe
6565 skipSignatureCheckRef . value = skipSignatureCheck ;
6666 configJustLoaded . value = true ;
6767 await executeGetConfig ( ) ;
68+ await nextTick ( ) ;
69+ configJustLoaded . value = false ;
6870} ;
6971
7072// MuMod 状态
0 commit comments