mkscho63/sta

Actor Items not Displaying to Clients

Closed this issue · 9 comments

Describe the bug
Updated Foundry to 11.299

To Reproduce
Steps to reproduce the behavior:

  1. Load your table.
  2. Click on any actor item
  3. See error from console:

Starships:
TypeError: An error occurred while rendering STAStarshipSheet 28. Cannot create property 'img' on string 'items'
at String. (starship-sheet.js:75:31)
at Function.each (jquery.min.js:2:3053)
at STAStarshipSheet.getData (starship-sheet.js:74:7)
at STAStarshipSheet._render (foundry.js:5726:29)
at STAStarshipSheet._render (foundry.js:6444:17)
at STAStarshipSheet.render (foundry.js:5683:10)
at STAStarshipSheet.render (foundry.js:7023:18)
at ActorDirectory._onClickEntryName (foundry.js:69173:20)
at HTMLOListElement.dispatch (jquery.min.js:2:43184)
at y.handle (jquery.min.js:2:41168)
onError @ foundry.js:753

Character Sheet:
TypeError: An error occurred while rendering STACharacterSheet 29. Cannot create property 'img' on string 'items'
at String. (character-sheet.js:82:31)
at Function.each (jquery.min.js:2:3053)
at STACharacterSheet.getData (character-sheet.js:81:7)
at STACharacterSheet._render (foundry.js:5726:29)
at STACharacterSheet._render (foundry.js:6444:17)
at STACharacterSheet.render (foundry.js:5683:10)
at STACharacterSheet.render (foundry.js:7023:18)
at ActorDirectory._onClickEntryName (foundry.js:69173:20)
at HTMLOListElement.dispatch (jquery.min.js:2:43184)
at y.handle (jquery.min.js:2:41168)
onError @ foundry.js:753

Expected behavior
Actor item should display

Desktop (please complete the following information):

  • OS: N/A (hosted instance of Foundry)
  • Browser: Edge
  • Version: Version 113.0.1774.50 (Official build) (64-bit)

As a quick workaround you can remove those problematic code blocks by editing 3 files in your {FoundryVTT user data path}/Data/systems/sta/module/actors/sheets folder. The files to modify are character-sheet.js, smallcraft-sheet.js, and starship-sheet.js

Find and remove these lines (restart Foundry after you do). This will not impact the functionality of the System.

// Checks if items for this actor have default images. Something with Foundry 0.7.9 broke this functionality operating normally.
// Stopgap until a better solution can be found.
$.each(sheetData.items, (key, item) => {
  if (!item.img) item.img = game.sta.defaultImage;
})

Wow, thanks for that. You just made about 8 people's weekend (we had two STA games this weekend we thought we'd have to cancel).

Thanks again!

P.S. Will this be fixed in an update?

Hopefully soon, this is a pretty major bug that basically renders this System inoperable on the latest Foundry. I'm not a maintainer so I can't address this directly, myself.

Yeah, latest version of Foundry is not supported currently by this system. I have to update it still but it might take me a few days. Until then I can't recommend updating Foundry instance if you're in need of this system.

Happy to report its the only buggy thing we could find.. We're on it now, guys are making characters for an upcoming campaign...

image

Hi. I'm not technically minded enough to know whether this issue might prevent actor sheets from opening at all. I'm in build 300 of foundry and v1.1.10 of STA. After several weeks' layoff and the updates, I can't get any of the actor sheets to open.

Yeah, that's what this issue is about, so you ended up in the right place.

The workaround can get you running again. I'd recommend saving a backup of your files before modifying anything, or try to manage without the System or downgrade your Foundry version for the time being.

I found the files, I found the lines of code, and I thought I successfully deleted them, but no dice, so to speak. It's possible, even fairly likely, that I erred. Is there a way to see what one of the files should look like once amended?

Including the change in the next release, it's currently up on the develop branch to be tested with other changes. Thanks for identifying the offending line!