mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-12-01 02:20:07 +08:00
refactor(draft): type async publication conflicts
Return typed conflicts for async Draft edits. Release the lock and edit permit before converting the error, and exercise overlapping updates.
This commit is contained in:
@@ -159,7 +159,7 @@ pub async fn delete_profile(index: std::string::String) -> CmdResult {
|
||||
|
||||
let profiles = Config::profiles().await;
|
||||
let result = profiles
|
||||
.with_data_modify(|mut candidate| async move {
|
||||
.with_data_modify::<_, _, _, anyhow::Error>(|mut candidate| async move {
|
||||
let original = candidate.clone();
|
||||
let (should_update, plan) = candidate.plan_delete_item(&index)?;
|
||||
let guard = if should_update {
|
||||
@@ -584,7 +584,7 @@ mod tests {
|
||||
profiles
|
||||
.with_data_modify(|mut committed| async move {
|
||||
committed.items.get_or_insert_with(Vec::new).push(profile("new"));
|
||||
Ok((committed, ()))
|
||||
Ok::<_, clash_verge_draft::DraftConflict>((committed, ()))
|
||||
})
|
||||
.await?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user