moved friend cursor data aggregation from frontend to backend

This commit is contained in:
2026-03-09 12:30:29 +08:00
parent 23c778a0bb
commit 69cfebee3d
8 changed files with 201 additions and 96 deletions

View File

@@ -1,7 +1,7 @@
use crate::{
get_app_handle, lock_r, lock_w,
remotes::{dolls::DollsRemote, friends::FriendRemote, user::UserRemote},
services::app_events::AppDataRefreshed,
services::{app_events::AppDataRefreshed, friend_cursor},
state::FDOLL,
};
use std::{collections::HashSet, sync::LazyLock};
@@ -161,6 +161,8 @@ pub async fn init_app_data_scoped(scope: AppDataRefreshScope) {
Ok(friends) => {
let mut guard = lock_w!(crate::state::FDOLL);
guard.user_data.friends = Some(friends);
drop(guard);
friend_cursor::sync_from_app_data();
}
Err(e) => {
warn!("Failed to fetch friends list: {}", e);
@@ -260,4 +262,6 @@ pub fn clear_app_data() {
guard.user_data.dolls = None;
guard.user_data.user = None;
guard.user_data.friends = None;
drop(guard);
friend_cursor::clear();
}