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

Bug with nested results for TRichSelect #232

Open
amkatyshev opened this issue Oct 5, 2021 · 0 comments
Open

Bug with nested results for TRichSelect #232

amkatyshev opened this issue Oct 5, 2021 · 0 comments

Comments

@amkatyshev
Copy link

amkatyshev commented Oct 5, 2021

I found one interesting point related to the work of TRichSelect
Generating nested elements requires a children key,
In my case, the data for TRichSelect is generated using FetchOptions and as a result I get the following data:

{
    id: 1,
    name: '1',
    children: [
        {id: 2, name: '2'},
        {id: 3, name: '3'},
    ]
}

Unfortunately for nested childrens, the normalizeOptions function ignores the textAttribute and valueAttribute data. Hence it turns out that the list is not rendered correctly.
I think that the normalizeOptions function needs to be fixed as follows:

const normalizeOptions = (options, textAttribute, valueAttribute) => {
    ...
    if (Array.isArray(options)) {
        return options.map((option) => normalizeOption(option, textAttribute, valueAttribute));
    }
    ...
};

But after these edits, it will be necessary to check the correctness of the render of the optGroup

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