Skip to content

Invalid mapping of parameters - empty string #21

@daugsbi

Description

@daugsbi

Hi, thanks a lot for this dataprovider. It works pretty well.
I've just stumbled over the following problem.

Reproduction

Create a ReferenceInput with an AutocompleteInput. The query that is build at the initialization (Empty search string) is the following, which results in an "Invalid filter value" backend error.
http://API/users?filter[0]=email||cont&limit=100&page=1&sort[0]=email%2CASC&offset=0

<ReferenceInput
        label="Benutzer"
        source="userId"
        reference="users"
        validate={[required()]}
        sort={{ field: "email", order: "ASC" }}
        perPage={100}
        // This results in an error
        filterToQuery={(search: string) => ({ email: search })}
        // This is a workaround
        filterToQuery={(search: string) => ({ email: search ? search : " "  })}
     >
        <AutocompleteInput optionText="email" optionValue="id" />
</ReferenceInput>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions