Skip to content

TypeError: value.map is not a function for saving settings #59

@lssweatherhead

Description

@lssweatherhead

Hello!

Umbraco version: 12.3.3
Preflight version: 12.0.0
Languages installed: just the default en-US

After the initial install this was working okay, but when I try to save the preflight settings it (doesn't do it) and returns this error in the console:

angular.js:15697 TypeError: value.map is not a function
    at preflight.min.js?d=638368770700000000:612:50
    at Array.forEach (<anonymous>)
    at SettingsController.saveSettings (preflight.min.js?d=638368770700000000:606:32)
    at fn (eval at compile (angular.js:16548:15), <anonymous>:4:168)
    at e (angular.js:29123:13)
    at m.$eval (angular.js:19523:16)
    at m.$apply (angular.js:19622:20)
    at HTMLFormElement.<anonymous> (angular.js:29127:13)
    at HTMLFormElement.dispatch (jquery.min.js?d=638368770700000000:2:40035)
    at v.handle (jquery.min.js?d=638368770700000000:2:38006)

It looks like this is happening in the part of the save settings function which is dealing with multipletextbox mapping, specifically this bit:

if (v.view.includes(constants_1.constants.multipletextbox)) {
    for (let [key, value] of Object.entries(v.value)) {
        v.value[key] = value.map(o => o.value).join(','); //here the value is null when it is trying to parse the naughty and nice words plugin
    }
}

This is what it has in the object:

{
    "guid": "1a465035-41d4-44a4-bf64-87ede0cea3be",
    "id": 5,
    "core": true,
    "label": "Nice words",
    "value": {
        "en-US": {
            "value": null
        }
    },
    "description": "These words will be excluded from the readability check",
    "view": "views/propertyeditors/multipletextbox/multipletextbox.html",
    "order": 0,
    "tab": "Naughty and nice",
    "alias": "niceWords",
    "prevalues": null
}

Not sure if I've maybe misconfigured this somewhere, or should be setting the language somewhere?
This seems to fail regardless of whether I have words in the naughty and nice lists or not

Happy to help with a fix if it is not just me missing something!

Cheers,
Laura

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions