League-of-Foundry-Developers / torch

Simple torch module for Foundry VTT
10 stars 16 forks source link

Torch conflict with lib-wrapper? #52

Open Naroek56 opened 1 year ago

Naroek56 commented 1 year ago

Hi,

Foundry 10.291 OSE 1.7.7 Torch 2.6.0

The problem occurs when enabling Torch and right-clicking a token. The torch hud doesn't appear and I get the following error message:

Uncaught (in promise) TypeError: mergedLibrary is undefined
[Detected 2 packages: torch, lib-wrapper]
    load library.js:99
    addTorchButton torch.js:28
    <anonymous> torch.js:93
    #call foundry.js:724
    callAll foundry.js:681
    _render foundry.js:5153
    _render foundry.js:68578
    render foundry.js:5067
    bind foundry.js:68553
    bind foundry.js:71376
    _onClickRight foundry.js:25580
    callback foundry.js:27813
    _handleClickRight foundry.js:28090
    _handleRightDown foundry.js:28070
    emit index.js:181
    dispatchEvent interaction.min.mjs:8
    processPointerDown interaction.min.mjs:8
    recursiveFindHit interaction.min.mjs:8
    recursiveFindHit interaction.min.mjs:8
    recursiveFindHit interaction.min.mjs:8
    recursiveFindHit interaction.min.mjs:8
    recursiveFindHit interaction.min.mjs:8
    recursiveFindHit interaction.min.mjs:8
    findHit interaction.min.mjs:8
    processInteractive interaction.min.mjs:8
    onPointerDown interaction.min.mjs:8
    addEvents interaction.min.mjs:8
    setTargetElement interaction.min.mjs:8
    r interaction.min.mjs:8
    initPlugins core.min.mjs:8
    r core.min.mjs:8
    create core.min.mjs:8
    ro core.min.mjs:8
    e app.min.mjs:8
    #createApplication foundry.js:23356
    initialize foundry.js:23258
    initializeCanvas foundry.js:8094
    setupGame foundry.js:7929
    _initializeGameView foundry.js:8999
    _initializeView foundry.js:8975
    initialize foundry.js:7825
    call_wrapped libWrapper-wrapper.js:507
    libWrapperInit libWrapper-api.js:803
    initialize#0 libWrapper-wrapper.js:187
    <anonymous> foundry.js:79693
    async* foundry.js:79675
library.js:99:9
    addTorchButton torch.js:54
    AsyncFunctionThrow self-hosted:814
    (Async: async)
    <anonymous> torch.js:93
    #call foundry.js:724
    callAll foundry.js:681
    _render foundry.js:5153
    AsyncFunctionNext self-hosted:810
    (Async: async)
    _render foundry.js:68578
    render foundry.js:5067
    bind foundry.js:68553
    bind foundry.js:71376
    _onClickRight foundry.js:25580
    callback foundry.js:27813
    _handleClickRight foundry.js:28090
    _handleRightDown foundry.js:28070
    _handleRightDown self-hosted:1359
    emit index.js:181
    dispatchEvent interaction.min.mjs:8
    processPointerDown interaction.min.mjs:8
    <anonymous> self-hosted:1359
    recursiveFindHit interaction.min.mjs:8
    recursiveFindHit interaction.min.mjs:8
    recursiveFindHit interaction.min.mjs:8
    recursiveFindHit interaction.min.mjs:8
    recursiveFindHit interaction.min.mjs:8
    recursiveFindHit interaction.min.mjs:8
    findHit interaction.min.mjs:8
    processInteractive interaction.min.mjs:8
    onPointerDown interaction.min.mjs:8
    <anonymous> self-hosted:1359
    (Async: EventListener.handleEvent)
    addEvents interaction.min.mjs:8
    setTargetElement interaction.min.mjs:8
    r interaction.min.mjs:8
    initPlugins core.min.mjs:8
    r core.min.mjs:8
    create core.min.mjs:8
    ro core.min.mjs:8
    e app.min.mjs:8
    #createApplication foundry.js:23356
    initialize foundry.js:23258
    initializeCanvas foundry.js:8094
    InterpretGeneratorResume self-hosted:1822
    AsyncFunctionNext self-hosted:810
    (Async: async)
    setupGame foundry.js:7929
    InterpretGeneratorResume self-hosted:1822
    AsyncFunctionNext self-hosted:810
    (Async: async)
    _initializeGameView foundry.js:8999
    _initializeView foundry.js:8975
    initialize foundry.js:7825
    InterpretGeneratorResume self-hosted:1822
    AsyncFunctionNext self-hosted:810
    (Async: async)
    call_wrapped libWrapper-wrapper.js:507
    call_wrapped self-hosted:1521
    libWrapperInit libWrapper-api.js:803
    AsyncFunctionNext self-hosted:810
    (Async: async)
    libWrapperInit self-hosted:1409
    initialize#0 libWrapper-wrapper.js:187
    <anonymous> foundry.js:79693
    AsyncFunctionNext self-hosted:810
    (Async: async)
    <anonymous> foundry.js:79675

Using "Find the culprit" I isolated the package... and the error persists, it just looks like this now:

mergedLibrary is undefined
    load library.js:99
    addTorchButton torch.js:28
    <anonymous> torch.js:93
    #call foundry.js:724
    callAll foundry.js:681
    _render foundry.js:5153
    _render foundry.js:68578
    render foundry.js:5067
    bind foundry.js:68553
    bind foundry.js:71376
    _onClickRight foundry.js:25580
    callback foundry.js:27813
    _handleClickRight foundry.js:28090
    _handleRightDown foundry.js:28070
    emit index.js:181
    dispatchEvent interaction.min.mjs:8
    processPointerDown interaction.min.mjs:8
    recursiveFindHit interaction.min.mjs:8
    recursiveFindHit interaction.min.mjs:8
    recursiveFindHit interaction.min.mjs:8
    recursiveFindHit interaction.min.mjs:8
    recursiveFindHit interaction.min.mjs:8
    recursiveFindHit interaction.min.mjs:8
    findHit interaction.min.mjs:8
    processInteractive interaction.min.mjs:8
    onPointerDown interaction.min.mjs:8
    addEvents interaction.min.mjs:8
    setTargetElement interaction.min.mjs:8
    r interaction.min.mjs:8
    initPlugins core.min.mjs:8
    r core.min.mjs:8
    create core.min.mjs:8
    ro core.min.mjs:8
    e app.min.mjs:8
    #createApplication foundry.js:23356
    initialize foundry.js:23258
    initializeCanvas foundry.js:8094
    setupGame foundry.js:7929
    _initializeGameView foundry.js:8999
    _initializeView foundry.js:8975
    initialize foundry.js:7825
    async* foundry.js:79693
    async* foundry.js:79675
library.js:99:9

I can't reproduce it in other worlds, and deleting and reinstalling each module doesn't have an impact, so I take it it's a world issue? I'd appreciate any help with this!

Thanks!

lupestro commented 1 year ago

I just tried OSE 1.8.3 with the same versions of Torch and Foundry you're using and it is working fine here. My first instinct is that this might happen if there were a glitch in a user-supplied Additional Light Sources file. (That interface is a little squishier than it might be.) Did you supply a JSON? If so, can you post it here? I can take a look. Aside from that, I'll be glad to work with you to find out what is really going on. (Sorry for the late reply - been a busy month.)

Naroek56 commented 1 year ago

Yeah, it's working fine in other worlds, just not in that one. How can I get the JSON? I'm using Forge.

lupestro commented 11 months ago

I finally got back to this - it sounds like something bad happened when it merged the user library data into the library. That's the right line for it to happen. I didn't answer your question. The JSON I'm asking about would be the JSON you might have supplied as a system setting, a source of additional data. It's the only thing that could be affecting the code in that area that would be world-specific.