Dorako / pf2e-dorako-ux

MIT License
4 stars 7 forks source link

Updated chat messages don't keep their header after refreshing the page #9

Closed K4rakara closed 9 months ago

K4rakara commented 10 months ago

Video demonstration

In this screencast, I'm using my own chat enhancement module, which I haven't released yet, but I've also been able to reproduce it with df-chat-enhance.

List of enabled modules:

Dorako commented 10 months ago

I'm not entirely sure what I'm looking at here - how does it look like if you actually type a message with "test" as the speaker? The thing that seems inconsistent to me is the avatar getting added in the first place.

K4rakara commented 10 months ago

Typing with test as the speaker adds the characters icon, which is just the default at the moment. Is it not supposed to add the default icon? Screencast from 2024-01-05 19-37-31.webm

Dorako commented 10 months ago

Considering you've made your own module, I think it'll probably be easier for you to debug it. Are there any errors in the console? Try setting breakpoints in message-hooks.js in Dorako UX and see if you can figure out why the Avatar renders when you update it, but not when you refresh. You might also want to explore the pf2e-dorako-ux message flags, perhaps the avatars are not defined in the original message, and as such the code that adds the actual image is skipped.

K4rakara commented 9 months ago

I'll be looking into this over the weekend, I'll let you know if I figure out.

K4rakara commented 9 months ago

I'm fairly certain that this is being caused by using .updateSource instead of .update in addAvatarsToFlags -- .updateSource only applies to the local version of the message, whereas .update actually sends the changes to the backend. Perhaps a second argument could be added to addAvatarsToFlags that would determine whether .updateSource or .update is used.

I'll do some testing locally, if I'm able to make a fix, I'll fork the repo and make a PR.

Dorako commented 9 months ago

Thanks, included for next release