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

Fix a bug where the dropdown with available dictionary items has only the first item #2725

Conversation

j-mok
Copy link
Contributor

@j-mok j-mok commented Nov 15, 2023

Description

We've run into a rare bug where some of our organization objects did not display full list of available dictionary items for one of the dynamic properties in the management -> Dynamic properties blade. The dropdown had just the first item. This turned out to happen when the API sent a value object with valueType of Undefined and no actual value property, something like this:

{
    ...
    "dynamicProperties": [
        {
            "values": [
                {
                    "objectType": "VirtoCommerce.CustomerModule.Core.Model.Organization",
                    "objectId": "1234",
                    "valueId": "xyz",
                    "valueType": "Undefined",
                    "propertyId": "MyCustomObject_VirtoCommerce.Domain.Customer.Model.Organization",
                    "propertyName": "MyCustomObject"
                }
            ],
            ...
        }
    ],
    ...
}

We don't know why the value was like that (maybe a side effect of migrating from VC 2), but it caused the following piece of JS to fail:

if (_.any(selectedValues, function (x) { return x.value.id == dictValue.id || x.valueId == dictValue.id })) {

Specifically, dereferencing x.value.id breaks the loop (as there is no value property) in its first iteration, hence only one item ends up in the dropdown.

@vc-ci
Copy link
Contributor

vc-ci commented Nov 15, 2023

Reveiw task created: https://virtocommerce.atlassian.net/browse/PT-14508

@OlegoO OlegoO merged commit 7ba69aa into VirtoCommerce:dev Nov 17, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants