Skip to content

Async anonymous function get lost in production #7457

Open
@vince1995

Description

@vince1995

Describe the bug

I have a function which calls an async anonymous function. Everything is fine in development but in production the relevant code is lost.

My code:

    getPOIInformation = (index) => {
        const activePOIObject = pois[this.state.activePOIIndex];
        const properties = activePOIObject.geojson.features[index].properties;
        console.log(properties);

        if (!properties.additionalInformation) {

            properties.additionalInformation = "LOADING";

            (async function () {
                const response = await api.getPoiInformation({ type: properties.osmType, id: properties.id });
                properties.additionalInformation = response;
                this.forceUpdate();
            }).bind(this)();

        }

        return properties.additionalInformation;
    }

Code after run build:

a.getPOIInformation = function (e) {
        var t = qe[a.state.activePOIIndex].geojson.features[e].properties;
        return console.log(t),
            t.additionalInformation || (t.additionalInformation = "LOADING"),
            t.additionalInformation
    }

I think there is something in the webpack/babel configuration wrong.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions