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

Referenced items won't be selected when IDs type differ in <ReferenceArrayInput> and <AutoCompleteInput> #8499

Closed
antoinefricker opened this issue Dec 13, 2022 · 0 comments · Fixed by #8500
Labels

Comments

@antoinefricker
Copy link
Contributor

antoinefricker commented Dec 13, 2022

What you were expecting:

Inputs handling arrays of IDs such as <ReferenceArrayInput> and <AutoCompleteInput> should allow types discrepancies in IDs types. For now, comparing ID "2" and 2 produces unexpected array of behaviours often reported in support or forums.

Related code:

Demo application

For the Artists resource, IDs are typed as number in the dataProvider getList method.
In the Bands resource, members are typed as (number | string)[].

Please note that members defined a string typed ID are not selected as initial display.

const fakeData = {
        bands: [{ id: 1, name: 'band_1', members: [1, "2"] }],
        artists: [
            { id: 1, name: 'artist_1' },
            { id: 2, name: 'artist_2' },
            { id: 3, name: 'artist_3' },
        ],
    };

Members inputs should display two artists of IDs '#1' and '#2'.

@antoinefricker antoinefricker changed the title Handling of incoherent IDs type Handling of incoherent IDs type in <ReferenceArrayInput> and <AutoCompleteInput> Dec 13, 2022
@antoinefricker antoinefricker changed the title Handling of incoherent IDs type in <ReferenceArrayInput> and <AutoCompleteInput> <ReferenceArrayInput> and <AutoCompleteInput> won't select referenced items when IDs type differ Dec 13, 2022
@antoinefricker antoinefricker changed the title <ReferenceArrayInput> and <AutoCompleteInput> won't select referenced items when IDs type differ Referenced items won't be selected when IDs type differ in <ReferenceArrayInput> and <AutoCompleteInput> Dec 13, 2022
@slax57 slax57 added the bug label Dec 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants