fix lan peers batch deletion (#8715)

`peers.map((p) async {})` is not sync and peers are loaded before deletion.

```
let mut peers = config::LanPeers::load().peers;
peers.retain(|x| x.id != id);
```

Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
21pages 2024-07-15 10:47:19 +08:00 committed by GitHub
parent e2a7e38a39
commit 8512c2b2b0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -399,9 +399,9 @@ class _PeerTabPageState extends State<PeerTabPage>
final peers = model.selectedPeers;
switch (model.currentTab) {
case 0:
peers.map((p) async {
for (var p in peers) {
await bind.mainRemovePeer(id: p.id);
}).toList();
}
await bind.mainLoadRecentPeers();
break;
case 1:
@ -413,9 +413,9 @@ class _PeerTabPageState extends State<PeerTabPage>
await bind.mainLoadFavPeers();
break;
case 2:
peers.map((p) async {
for (var p in peers) {
await bind.mainRemoveDiscovered(id: p.id);
}).toList();
}
await bind.mainLoadLanPeers();
break;
case 3: