refactor global search

This commit is contained in:
pa
2026-03-14 19:59:21 +09:00
parent 45f3eacf21
commit b750d3fb9a
20 changed files with 655 additions and 181 deletions
+7
View File
@@ -17,6 +17,7 @@ import {
runPendingOfflineTickFlow,
runUpdateFriendFlow
} from '../coordinators/friendPresenceCoordinator';
import { syncFriendSearchIndex } from '../coordinators/searchIndexCoordinator';
import {
updateFriendship,
runUpdateFriendshipsFlow
@@ -340,19 +341,24 @@ export const useFriendStore = defineStore('Friend', () => {
for (id of ref.onlineFriends) {
map.set(id, 'online');
}
const added = [];
const removed = [];
for (const friend of map) {
const [id, state_input] = friend;
if (friends.has(id)) {
runUpdateFriendFlow(id, state_input);
} else {
addFriend(id, state_input);
added.push(id);
}
}
for (id of friends.keys()) {
if (map.has(id) === false) {
deleteFriend(id);
removed.push(id);
}
}
return { added, removed };
}
/**
@@ -389,6 +395,7 @@ export const useFriendStore = defineStore('Friend', () => {
const array = memo.memo.split('\n');
ctx.$nickName = array[0];
}
syncFriendSearchIndex(ctx);
}
});
}