fix: align draft commit/save semantics

- use committed profiles snapshot for lifecycle saves (avoid persisting uncommitted drafts)
- remove apply/discard calls after profiles with_data_modify helpers
- persist profiles metadata explicitly in create_profile
- apply clash draft before saving mode changes
- surface deep-link profile save failures via logging
This commit is contained in:
Tunglies
2026-03-21 18:54:47 +08:00
parent 85eb3b48c2
commit 70a86b05c5
4 changed files with 15 additions and 23 deletions
+2 -2
View File
@@ -9,7 +9,7 @@ use crate::{
config::{Config, PrfItem, profiles},
core::{CoreManager, handle},
};
use clash_verge_logging::{Type, logging};
use clash_verge_logging::{Type, logging, logging_error};
pub(super) async fn resolve_scheme(param: &str) -> Result<()> {
logging!(info, Type::Config, "received deep link: {param}");
@@ -94,7 +94,7 @@ async fn import_subscription(url: &str, name: Option<&String>) {
}
Config::profiles().await.apply();
let _ = Config::profiles().await.data_arc().save_file().await;
logging_error!(Type::Config, Config::profiles().await.data_arc().save_file().await);
handle::Handle::notice_message(
"import_sub_url::ok",
"", // 空 msg 传入,我们不希望导致 后端-前端-后端 死循环,这里只做提醒。