question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AutocompleteArrayInput allows to pick repeated values (probably a feature?)

See original GitHub issue
import { AutocompleteArrayInput } from 'react-admin';

<AutocompleteArrayInput source="category" choices={[
    { id: 'programming', name: 'Programming' },
    { id: 'lifestyle', name: 'Lifestyle' },
    { id: 'photography', name: 'Photography' },
]} />

Just use the example component. It allows to pick the same value twice. If you remove one of the repeated values, all of them are removed, so it looks like it probably doesn’t make sense to allow repeated values (bug).

If it does make sense, there should be an attribute to control whether we want repeated values or not (feature)?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:4
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
tiagoschenkelcommented, Jul 11, 2019

I’m still waiting for a feedback on this merge request: https://github.com/marmelab/react-admin/pull/2912

@djhi, could you please take a look and tell us what is missing?

2reactions
tiagoschenkelcommented, Feb 7, 2019

The method handleSuggestionSelected is adding the new value directly to the input through onChange method. Even when the property allowDuplicates is enabled in the AutocompleteArrayInputChip this element is added.

A possible solution will be to add a new property to AutocompleteArrayInput component, named allowDuplicates, then check for this property before calling the input.onChange method.

Here is my implementation, let me know if is fine for a merge request: https://github.com/tiagoschenkel/react-admin/commit/410943a7930f3db182747fff007bee92a0ea1064

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to make AutocompleteArrayInput allow new values?
Some time ago I made a Select-component that can do this, if placed inside a component.
Read more >
Find and remove duplicates - Microsoft Support
Find and remove duplicates · Select the cells you want to check for duplicates. · Click Home > Conditional Formatting > Highlight Cells...
Read more >
React-admin - Field Components - Marmelab
Field Components. A Field component displays a given property of a record. Such components are used in the List and Show views, but...
Read more >
How to Remove Duplicates from a Bigquery Table - Dataform
The best strategy for managing duplicate records is to use a SELECT query to augment the original structure, then save the results to...
Read more >
How to find, manage and remove duplicates in Excel
1. How to identify duplicates ... The first tool is one of the options on the Conditional Formatting feature. As its name suggests,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found