I know 5.3.0 is not officially released yet, but I wanted to report this early because it looks like a small regression in the chat message render flow.
The Hook dnd5e.renderChatMessage does not seem to fire for the new usage-messages when they are re-rendered after message.setFlag(...).
I can reproduce it with a normal dnd5e usage message and a simple macro. renderChatMessageHTML still fires, so the message does re-render, but the dnd5e-specific post-render hook appears to be skipped. This same general workflow worked for me in 5.2.x.
Steps to Reproduce
- Create any normal dnd5e usage-message, for example by using an item/activity that creates a usage message.
- Make sure that usage-message is the latest chat message.
- Run this macro:
Hooks.on("renderChatMessageHTML", (message) => {
console.log("renderChatMessageHTML", message.id, message.type);
});
Hooks.on("dnd5e.renderChatMessage", (message) => {
console.log("dnd5e.renderChatMessage", message.id, message.type);
});
const message = game.messages.contents.at(-1);
await message?.setFlag("world", "testFlag", foundry.utils.randomID());
- Check the console output.
For me, renderChatMessageHTML fires for the updated message, but dnd5e.renderChatMessage does not.
If I repeat the same test with a regular base chat message, both hooks fire as expected
This looks related to the early return in chat-message.mjs:
if ( foundry.utils.getType(this.system?.getHTML) === "function" ) {
await this.system.getHTML(html, options);
return html;
}
That seems to skip the later Hooks.callAll("dnd5e.renderChatMessage", this, html) for messages rendered through system.getHTML.
Tested without any modules on Foundry V13 351 and V14 358, using the latest current 5.3.x branch state from GitHub.
I know 5.3.0 is not officially released yet, but I wanted to report this early because it looks like a small regression in the chat message render flow.
The Hook
dnd5e.renderChatMessagedoes not seem to fire for the new usage-messages when they are re-rendered aftermessage.setFlag(...).I can reproduce it with a normal dnd5e usage message and a simple macro.
renderChatMessageHTMLstill fires, so the message does re-render, but the dnd5e-specific post-render hook appears to be skipped. This same general workflow worked for me in 5.2.x.Steps to Reproduce
For me,
renderChatMessageHTMLfires for the updated message, butdnd5e.renderChatMessagedoes not.If I repeat the same test with a regular base chat message, both hooks fire as expected
This looks related to the early return in chat-message.mjs:
That seems to skip the later
Hooks.callAll("dnd5e.renderChatMessage", this, html)for messages rendered throughsystem.getHTML.Tested without any modules on Foundry V13 351 and V14 358, using the latest current 5.3.x branch state from GitHub.