Core: 5.1.0 Ports variable 'result' not defined/in scope?

Created on 23 Jan 2017  路  6Comments  路  Source: elm/core

Upgraded to 5.1.0, and now on any port send I'm getting the following error:
ReferenceError: Can't find variable: result

looks like there is no result variable in scope at the line var value = result._0; in the following compiled JS:

function setupIncomingPort(name, callback)
    {
        var sentBeforeInit = [];
        var subs = _elm_lang$core$Native_List.Nil;
        var converter = effectManagers[name].converter;
        var currentOnEffects = preInitOnEffects;
        var currentSend = preInitSend;

        // CREATE MANAGER

        var init = _elm_lang$core$Native_Scheduler.succeed(null);

        function preInitOnEffects(router, subList, state)
        {
            var postInitResult = postInitOnEffects(router, subList, state);

            for(var i = 0; i < sentBeforeInit.length; i++)
            {
                postInitSend(sentBeforeInit[i]);
            }

            sentBeforeInit = null; // to release objects held in queue
            currentSend = postInitSend;
            currentOnEffects = postInitOnEffects;
            return postInitResult;
        }

        function postInitOnEffects(router, subList, state)
        {
            subs = subList;
            return init;
        }

        function onEffects(router, subList, state)
        {
            return currentOnEffects(router, subList, state);
        }

        effectManagers[name].init = init;
        effectManagers[name].onEffects = F3(onEffects);

        // PUBLIC API

        function preInitSend(value)
        {
            sentBeforeInit.push(value);
        }

        function postInitSend(incomingValue)
        {
            var value = result._0;
            var temp = subs;
            while (temp.ctor !== '[]')
            {
                callback(temp._0(value));
                temp = temp._1;
            }
        }

Most helpful comment

Further complicating this issue is that elm-package won't install [email protected] with the following version string in elm-package.json: "elm-lang/core": "5.0.0 <= v < 5.0.1",

Is there a workaround for installing a specific version?

All 6 comments

Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!

Here is what to expect next, and if anyone wants to comment, keep these things in mind.

having the exact same issue.
popped up after upgrading to 5.1.0

Further complicating this issue is that elm-package won't install [email protected] with the following version string in elm-package.json: "elm-lang/core": "5.0.0 <= v < 5.0.1",

Is there a workaround for installing a specific version?

working on a fix, will submit in 1 minute

Thanks again to @keithasaurus for the report and @lukewestby for the very quick fix! Sorry to everyone who ran into this. A 5.1.1 is out with the fix, but please let me know if there are any further issues.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

liamcurry picture liamcurry  路  4Comments

mzero picture mzero  路  3Comments

opvasger picture opvasger  路  6Comments

RobertWalter83 picture RobertWalter83  路  4Comments

dullbananas picture dullbananas  路  3Comments