修复客户端常用设置读写卡顿
Project CI / Frontend tests (pull_request) Successful in 2m46s
Project CI / Backend tests (pull_request) Successful in 5m57s
Project CI / Repository checks (pull_request) Successful in 2m30s
Project CI / Native shell tests (pull_request) Failing after 15m32s

移除常用设置读取和保存后的外部诊断调用
减少配置读取时的重复权限修复和保存后的重复回读
补充常用设置无需外部诊断的原因注释
This commit is contained in:
2026-09-08 12:58:29 +00:00
parent 1498247e9f
commit 5efd88cb3e
3 changed files with 9 additions and 24 deletions
@@ -2037,7 +2037,10 @@ fn persist_game_creator_app_config(
let path = writable_game_creator_config_path()?;
let content = serialize_game_creator_app_config_for_renderer_write(&config)?;
write_game_creator_config_atomically(&path, &format!("{content}\n"))?;
game_creator_app_config_view(load_game_creator_app_config()?)
// `config` is already normalized and is exactly what was persisted.
// Avoid reloading it here: a reload repeats the Windows private-path and
// ACL checks and made saving the settings panel appear to hang.
game_creator_app_config_view(config)
}
#[tauri::command]
@@ -3272,9 +3272,10 @@ pub(crate) fn configure_game_creator_runtime_config_dir(
Ok(())
}
/// Validates a persisted AGC config file without following links. Existing
/// regular files are tightened through the same Windows owner/DACL gate used
/// by credential files before any read is allowed.
/// Validates a persisted AGC config file without following links.
///
/// Reading configuration must remain read-only. ACL hardening is performed
/// when the file is created or replaced, not on every settings-panel read.
fn validate_game_creator_config_file_entry(path: &Path) -> Result<bool, String> {
#[cfg(windows)]
validate_game_creator_private_path_ancestors_with_auto_elevation(path, "客户端配置文件")?;
@@ -3293,8 +3294,6 @@ fn validate_game_creator_config_file_entry(path: &Path) -> Result<bool, String>
if metadata.file_type().is_symlink() || !metadata.is_file() {
return Err("客户端配置文件必须是普通文件,不能是链接或其他对象".to_string());
}
#[cfg(windows)]
secure_windows_game_creator_path_for_current_user_with_auto_elevation(path, false, true)?;
Ok(true)
}
@@ -470,6 +470,7 @@ export function RuntimeConfigDialog({
}));
}
// 常用设置仅调整运行参数,读写时无需外部诊断,避免进程探测拖慢页面加载和保存反馈。
async function readRuntimeConfig() {
if (runtimeConfigBusyRef.current) {
return;
@@ -494,15 +495,6 @@ export function RuntimeConfigDialog({
);
setRuntimeConfigDraft(config);
setRuntimeConfigStatus(`已读取:${result.path}`);
try {
const status = await invoke<GameCreatorLlmConfigStatus>(
'check_game_creator_llm_config',
);
setEffectiveLlmConfigStatus(status);
} catch {
// Older test fixtures and non-Tauri previews may not expose the
// diagnostic command; the config read itself remains usable.
}
onLog?.('runtime_config.read');
} catch (error) {
setRuntimeConfigStatus(
@@ -551,15 +543,6 @@ export function RuntimeConfigDialog({
);
setRuntimeConfigDraft(savedConfig);
setRuntimeConfigStatus(`已保存:${result.path}`);
try {
const status = await invoke<GameCreatorLlmConfigStatus>(
'check_game_creator_llm_config',
);
setEffectiveLlmConfigStatus(status);
} catch {
// Keep the last safe status when the optional diagnostic refresh is
// unavailable in a preview or test fixture.
}
setRuntimeConfigToast({
tone: 'success',
message: '保存成功,新的运行时配置已生效',