elm / compiler

Compiler for Elm, a functional language for reliable webapps.
https://elm-lang.org/
BSD 3-Clause "New" or "Revised" License
7.55k stars 662 forks source link

The same code runs normal when compiled with --debug, and crashes without #2063

Closed phi1ipp closed 4 years ago

phi1ipp commented 4 years ago

Elm element inside html/js page when compiled without --debug:

SSCCE

Additional Details

Elm element is shown inside modal dialog. Is called multiple times on the page every time with flags passed into Elm.

    var elm = Elm.LibReview.init({
        flags: { surveyId: surveyId.slice(-24), elmIdx: commentID.hashCode(), 
                         elmName: commentID, user: user},
        node: document.getElementById('review-container')
    });

Errors thrown into console:

TypeError: undefined has no properties                             main.js:2903:21
    _VirtualDom_applyEvents http://localhost:8000/elm/main.js:2903
    _VirtualDom_applyFacts http://localhost:8000/elm/main.js:2834
    _VirtualDom_applyPatch http://localhost:8000/elm/main.js:3719
    _VirtualDom_applyPatchesHelp http://localhost:8000/elm/main.js:3702
    _VirtualDom_applyPatches http://localhost:8000/elm/main.js:3693
    _Browser_element http://localhost:8000/elm/main.js:3948
    updateIfNeeded http://localhost:8000/elm/main.js:4017
TypeError: domNode is undefined                                   main.js:2903:21
    _VirtualDom_applyEvents http://localhost:8000/elm/main.js:2903
    _VirtualDom_applyFacts http://localhost:8000/elm/main.js:2834
    _VirtualDom_applyPatch http://localhost:8000/elm/main.js:3719
    _VirtualDom_applyPatchesHelp http://localhost:8000/elm/main.js:3702  
    _VirtualDom_applyPatches http://localhost:8000/elm/main.js:3693 
    _Browser_element http://localhost:8000/elm/main.js:3948 
    updateIfNeeded http://localhost:8000/elm/main.js:4017
github-actions[bot] commented 4 years ago

Thanks for reporting this! To set expectations:

Finally, please be patient with the core team. They are trying their best with limited resources.

phi1ipp commented 4 years ago

Never mind, I think I was not using Elm.init correctly trying to call it multiple times