Default to first sub; update SubIndexId on delete
Some checks are pending
release Linux / build (push) Waiting to run
release Linux / release-zip (push) Blocked by required conditions
release Linux / build and release deb x64 & arm64 (push) Waiting to run
release Linux / build and release rpm x64 & arm64 (push) Waiting to run
release Linux / build and release rpm riscv64 (push) Waiting to run
release macOS / build (push) Waiting to run
release macOS / release-zip (push) Blocked by required conditions
release macOS / package and release macOS dmg (push) Blocked by required conditions
release Windows desktop (Avalonia UI) / build (push) Waiting to run
release Windows desktop (Avalonia UI) / release-zip (push) Blocked by required conditions
release Windows / build (push) Waiting to run
release Windows / release-zip (push) Blocked by required conditions

https://github.com/2dust/v2rayN/issues/9151
This commit is contained in:
2dust 2026-04-20 19:23:45 +08:00
parent 90b055e364
commit 39ef5d8174
3 changed files with 8 additions and 2 deletions

View file

@ -1936,6 +1936,12 @@ public static class ConfigHandler
await SQLiteHelper.Instance.DeleteAsync(item);
await RemoveServersViaSubid(config, id, false);
if (item.Id == config.SubIndexId)
{
var subs = await AppManager.Instance.SubItems();
config.SubIndexId = subs.LastOrDefault()?.Id;
}
return 0;
}

View file

@ -190,7 +190,7 @@ public class ProfilesSelectViewModel : MyReactiveObject
}
SelectedSub = (_config.SubIndexId.IsNotEmpty()
? SubItems.FirstOrDefault(t => t.Id == _config.SubIndexId)
: null) ?? SubItems.LastOrDefault();
: null) ?? SubItems.FirstOrDefault();
}
private async Task<List<ProfileItemModel>?> GetProfileItemsEx(string subid, string filter)

View file

@ -393,7 +393,7 @@ public class ProfilesViewModel : MyReactiveObject
}
SelectedSub = (_config.SubIndexId.IsNotEmpty()
? SubItems.FirstOrDefault(t => t.Id == _config.SubIndexId)
: null) ?? SubItems.LastOrDefault();
: null) ?? SubItems.FirstOrDefault();
}
private async Task<List<ProfileItemModel>?> GetProfileItemsEx(string subid, string filter)