mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2026-04-06 01:25:38 +00:00
fix won room select
This commit is contained in:
parent
532f4e855b
commit
0cc953fcd6
@ -606,7 +606,15 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
async fetchMessages({ room, options = {} }) {
|
async fetchMessages({ room, options = {} }) {
|
||||||
this.activeRoomId = room.roomId
|
if (!room?.roomId) return
|
||||||
|
// When an external socket message added a new room, the library may try to
|
||||||
|
// auto-select it. Lock activeRoomId to the current room to prevent focus steal.
|
||||||
|
if (this._externalRoomIds?.has(room.roomId)) {
|
||||||
|
this._externalRoomIds.delete(room.roomId)
|
||||||
|
if (this.selectedRoom) {
|
||||||
|
this.activeRoomId = this.selectedRoom.roomId
|
||||||
|
}
|
||||||
|
}
|
||||||
if (this.selectedRoom?.id !== room.id) {
|
if (this.selectedRoom?.id !== room.id) {
|
||||||
this.messages = []
|
this.messages = []
|
||||||
this.oldestLoadedIndexId = null
|
this.oldestLoadedIndexId = null
|
||||||
@ -678,6 +686,8 @@ export default {
|
|||||||
})
|
})
|
||||||
if (Room?.length) {
|
if (Room?.length) {
|
||||||
const newRoom = this.fixRoomObject(Room[0])
|
const newRoom = this.fixRoomObject(Room[0])
|
||||||
|
if (!this._externalRoomIds) this._externalRoomIds = new Set()
|
||||||
|
this._externalRoomIds.add(newRoom.roomId)
|
||||||
this.rooms = [newRoom, ...this.rooms]
|
this.rooms = [newRoom, ...this.rooms]
|
||||||
roomIndex = 0
|
roomIndex = 0
|
||||||
freshlyFetched = true
|
freshlyFetched = true
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user