Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
lssweatherhead opened this issue Nov 29, 2023 · 1 comment
Open

Comments

@lssweatherhead
Copy link

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

@lssweatherhead
Copy link
Author

Oh and it also throws a slightly different error if I try to add new words to the naughty/nice lists (the more I write about this issue, the more I am feeling like Father Christmas)

This error, I'm guessing related to the same null issue
angular.js:15697 TypeError: $scope.model.value.push is not a function

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant