avoid stack overflow
This commit is contained in:
parent
0713d5500b
commit
f6dd79c159
2 changed files with 14 additions and 6 deletions
|
|
@ -491,10 +491,14 @@ const processChats = () => {
|
||||||
|
|
||||||
chats.push(chat)
|
chats.push(chat)
|
||||||
|
|
||||||
// eslint-disable-next-line no-empty-function
|
if (typeof pubToAvatar[out.with] === 'undefined') {
|
||||||
Streams.onAvatar(() => {}, out.with)
|
// eslint-disable-next-line no-empty-function
|
||||||
// eslint-disable-next-line no-empty-function
|
Streams.onAvatar(() => {}, out.with)
|
||||||
Streams.onDisplayName(() => {}, out.with)
|
}
|
||||||
|
if (typeof pubToDn[out.with] === 'undefined') {
|
||||||
|
// eslint-disable-next-line no-empty-function
|
||||||
|
Streams.onDisplayName(() => {}, out.with)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
currentChats = chats.filter(c => c.messages.length > 0)
|
currentChats = chats.filter(c => c.messages.length > 0)
|
||||||
|
|
|
||||||
|
|
@ -37,8 +37,10 @@ const onAvatar = (cb, pub) => {
|
||||||
.on(av => {
|
.on(av => {
|
||||||
if (typeof av === 'string' || av === null) {
|
if (typeof av === 'string' || av === null) {
|
||||||
pubToAvatar[pub] = av || null
|
pubToAvatar[pub] = av || null
|
||||||
notifyAvatarListeners()
|
} else {
|
||||||
|
pubToAvatar[pub] = null
|
||||||
}
|
}
|
||||||
|
notifyAvatarListeners()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return () => {
|
return () => {
|
||||||
|
|
@ -80,8 +82,10 @@ const onDisplayName = (cb, pub) => {
|
||||||
.on(dn => {
|
.on(dn => {
|
||||||
if (typeof dn === 'string' || dn === null) {
|
if (typeof dn === 'string' || dn === null) {
|
||||||
pubToDisplayName[pub] = dn || null
|
pubToDisplayName[pub] = dn || null
|
||||||
notifyDisplayNameListeners()
|
} else {
|
||||||
|
pubToDisplayName
|
||||||
}
|
}
|
||||||
|
notifyDisplayNameListeners()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return () => {
|
return () => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue