zeel01 / MonsterBlocks

A Foundry VTT module to add NPC sheets that faithfully reproduce the appearance of D&D 5e monster statblocks.
29 stars 26 forks source link

Object Promise Issue in v12 #233

Open friction1 opened 5 months ago

friction1 commented 5 months ago

Everything clicks just fine but the descriptions of actions look like this.

Screenshot 2024-06-22 at 3 12 40 PM

MacOS v12.327 dnd5e 3.2.1

friction1 commented 5 months ago

The only place I even see the word Promise in the code is in a comment: MonsterBlock5e.js

/**

zeel01 commented 5 months ago

Looks like something in v12 changed to async, and it's not being awaited.

Cergorach commented 5 months ago

This section seems to be the issue in MonsterBlock5e.js for v12, the last line:

    static handlebarsHelpers = {
        "moblok-hascontents": (obj) => { // Check if an array is empty.
            return obj && Object.keys(obj).length > 0;
        },
        "moblok-enrichhtml": (str, owner, flags) => { // Formats any text to include proper inline rolls and links.
            // Note: in v12 the async option will be deprecated
            // enrichment should happen in getData() and not during rendering
            // that would be a big refactor so I'm not going to try it now...
            return TextEditor.enrichHTML(str || "", { secrets: (owner && !flags["hidden-secrets"]), async: false });
        }
    }

"async: false" doesn't work anymore in v12 as mentioned here: https://foundryvtt.com/article/v10-text-editor/

This is how the core 3.2.1 dnd5e system implements it for items: https://github.com/foundryvtt/dnd5e/blob/a010ce7e6768ac1301cd53c821c05e9fcce03dcb/module/applications/item/item-sheet.mjs

zeel01 commented 4 months ago

Oof, my own code comments are quite ominous. This is going to be a big issue to fix.