feat: add store methods for deleted user cleanup
Add removeRequestsForUser (socialStore), removeUser (discoverStore), and clearTypingForUser (chatStore) to support isDeleted cleanup in the user_updated WS handler.
This commit is contained in:
@@ -56,6 +56,7 @@ interface SocialState {
|
||||
updateFriendProfile: (user: User) => void;
|
||||
removeFriendLocally: (userId: string, origin: string) => void;
|
||||
removeRequestById: (requestId: string, origin: string) => void;
|
||||
removeRequestsForUser: (userId: string) => void;
|
||||
reset: () => void;
|
||||
}
|
||||
|
||||
@@ -326,6 +327,13 @@ export const useSocialStore = create<SocialState>((set, get) => ({
|
||||
}));
|
||||
},
|
||||
|
||||
// Called when a user is deleted — remove all pending requests involving them
|
||||
removeRequestsForUser: (userId: string) => {
|
||||
set((state) => ({
|
||||
requests: state.requests.filter(r => r.fromId !== userId && r.toId !== userId),
|
||||
}));
|
||||
},
|
||||
|
||||
// Called from WS handler on presence_update to keep friend status live
|
||||
updateFriendPresence: (userId: string, status: string) => {
|
||||
set((state) => ({
|
||||
|
||||
Reference in New Issue
Block a user