Skip to content

fix(character): handle undefined characterModelTransmogs array#45

Open
kamikyforce wants to merge 3 commits intor-o-b-o-t-o:masterfrom
kamikyforce:brand-new
Open

fix(character): handle undefined characterModelTransmogs array#45
kamikyforce wants to merge 3 commits intor-o-b-o-t-o:masterfrom
kamikyforce:brand-new

Conversation

@kamikyforce
Copy link

Summary

  • Adds defensive checks to safely handle cases where charData.characterModelTransmogs is undefined.
  • Prevents viewer errors when the transmogrification module is disabled or a character has no transmogs.
  • Keeps UI behavior consistent: the “Hide transmogrifications” option only appears when transmogs exist.

Changes

  • Use Array.isArray(charData.characterModelTransmogs) before reading or iterating:
    • Toggle handler computes items with a safe fallback to charData.characterModelItems.
    • setSlotVisible decides whether to use transmogs only when the array exists.
  • Initialize characterModel.items with a safe fallback:
    • Uses (charData.characterModelTransmogs ?? charData.characterModelItems) so models render even without transmogs.
  • Show transmogs UI only when applicable:
    • Display the label/list only if characterModelTransmogs exists and there are items with a transmog.

Code References

  • Toggle handler fallback: static/character.hbs:166–170
  • Slot visibility guard: static/character.hbs:197–201
  • Transmogs UI visibility: static/character.hbs:153–165
  • Initial items with fallback: static/character.hbs:425–426

Behavior

  • With transmogs available: toggle works as before; viewer uses transmogs when “Hide transmogrifications” is unchecked.
  • Without transmogs (or module disabled): viewer renders the base items; no JS errors; transmogs UI stays hidden.

Testing

  • Disable transmogs (e.g., ACORE_ARMORY_TRANSMOG_MODULE=0) or use a character without transmogs:
    • Page loads without console errors.
    • Toggling “Hide transmogrifications” does not throw and correctly uses base items.
  • Enable transmogs and use a character with transmogs:
    • Transmogs list appears.
    • Toggling hide shows/hides transmogs as expected; slot visibility changes respect the helm/cloak/tabard checkboxes.

Notes

  • Only static/character.hbs is changed in this branch. No other files or data assets are included.

Micael Santana added 3 commits December 7, 2025 08:05
Add checks for Array.isArray(charData.characterModelTransmogs) to prevent errors when the array is undefined
Add checks for Array.isArray(charData.characterModelTransmogs) to prevent errors when the array is undefined
Refine gitignore rules for data directory to explicitly ignore all generated assets
while keeping specific tracked files like background image and CSVs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant