Skip to content

Commit

Permalink
fix message popout not refreshing properly
Browse files Browse the repository at this point in the history
  • Loading branch information
reonZ committed Nov 30, 2023
1 parent bcc3676 commit 14d829e
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/features/target.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ async function renderChatMessage(message, html) {

if (clientEnabled && message.isDamageRoll) {
await renderDamageChatMessage(message, html)
scrollToBottom(message)
refreshMessage(message)
return
}

Expand All @@ -210,7 +210,7 @@ async function renderChatMessage(message, html) {

if (clientEnabled && !item.damageKinds.size) {
await renderSpellChatMessage(message, html, item)
scrollToBottom(message)
refreshMessage(message)
return
}

Expand All @@ -221,7 +221,7 @@ async function renderChatMessage(message, html) {
}
}

async function scrollToBottom(message) {
function refreshMessage(message) {
Promise.all(
[ui.chat, ui.chat._popout].map(async chat => {
const el = chat?.element[0]?.querySelector('#chat-log')
Expand All @@ -231,6 +231,13 @@ async function scrollToBottom(message) {
el.scrollTop = el.scrollHeight
})
)

for (const app of Object.values(message.apps)) {
if (!(app instanceof ChatPopout)) continue
if (!app.rendered) continue

app.setPosition()
}
}

async function renderSpellChatMessage(message, html, spell) {
Expand Down

0 comments on commit 14d829e

Please sign in to comment.