When I set up a monster in a compendium in my world, attacking with the monster's weapon and then clicking on its Damage button on the chat triggers an error. The damage roll fails to happen too.
Console says:
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'items')
at Knave2eChatMessage.onDamageFromChat (items.mjs:362:48)
at HTMLLIElement.dispatch (jquery.min.js:2:40035)
at v.handle (jquery.min.js:2:38006)
I believe I was able to reproduce the same error in other scenarios, particularly when working with compendium packs (from system or world), but I think I had a similar case happen with an actor from the Actors tab, this is only the easiest to reproduce. I didn't document other cases as well as this one, but I could try if I get them again. Running the attack from the monster's sheet with no actor on the screen (e.g. in a scene) is the easiest way to trigger the issue.
Depending on the scenario, the issue seems related to an undefined actor or an undefined item when rolling damage from the attack message in the chat. Sorry if this doesn't make sense, I've only just started with Foundry development, that's just my guess.
If interested, my fix looks like this. It's meant to look for the undefined actor and items in places the code seemed to miss. RafaelLVX@e8ab55e
To be honest, it's a lot of logic just for working around the issue of not picking up actor or item info, so maybe there's a much more simple way of doing it. But that was what I managed. After the fix above, I don't see the issue anymore on my side in any scenario I tried.
I can write a pull request if you want this fix applied upstream, or feel free to copy all or parts of it to your own side however you like.
When I set up a monster in a compendium in my world, attacking with the monster's weapon and then clicking on its Damage button on the chat triggers an error. The damage roll fails to happen too.
Console says:
I believe I was able to reproduce the same error in other scenarios, particularly when working with compendium packs (from system or world), but I think I had a similar case happen with an actor from the Actors tab, this is only the easiest to reproduce. I didn't document other cases as well as this one, but I could try if I get them again. Running the attack from the monster's sheet with no actor on the screen (e.g. in a scene) is the easiest way to trigger the issue.
Depending on the scenario, the issue seems related to an undefined actor or an undefined item when rolling damage from the attack message in the chat. Sorry if this doesn't make sense, I've only just started with Foundry development, that's just my guess.
If interested, my fix looks like this. It's meant to look for the undefined actor and items in places the code seemed to miss. RafaelLVX@e8ab55e
To be honest, it's a lot of logic just for working around the issue of not picking up actor or item info, so maybe there's a much more simple way of doing it. But that was what I managed. After the fix above, I don't see the issue anymore on my side in any scenario I tried.
I can write a pull request if you want this fix applied upstream, or feel free to copy all or parts of it to your own side however you like.