fix(mobile): KI-AGENT: Neu angelegte Chats vor veralteten Listen schützen
This commit is contained in:
@@ -92,6 +92,8 @@ function ChatScreen({ token }: { token: string }) {
|
||||
setBusy(room.key);
|
||||
const ready = await chatApi.provision(token, room);
|
||||
if (!alive.current || version !== selectionRevision.current || directoryRef.current?.hiddenRoomKeys.includes(room.key)) return;
|
||||
// A list requested before provisioning must not replace the new room with its placeholder.
|
||||
++directoryRevision.current;
|
||||
setDirectory(previous => previous && ({ ...previous, rooms: previous.rooms.map(item => item.key === room.key ? ready : item) }));
|
||||
setActiveKey(ready.key);
|
||||
} catch (err) { if (alive.current && version === selectionRevision.current) setError(err instanceof Error ? err.message : 'Chat konnte nicht geöffnet werden.'); }
|
||||
|
||||
Reference in New Issue
Block a user