Tagify: Same value with different attributes considered duplicate

Created on 24 May 2019  路  4Comments  路  Source: yairEO/tagify

I have 2 different tags like this:

[
  { value: 'Gencer', id: 1, type: 'folder', data: {...} },
  { value: 'Gencer', id, 5, type: 'category', data: {...} }
]

As you can see, both tags are valued as Gencer. However, their attributes are different. One of them is a folder and other is category. I also render items and add icons based on type.

Problem starts here, When folder Gencer added, category Gencer cannot be added. If duplicates enabled, this time folder and category can be added multiple time. Also dropdown autocomplete does not show category when folder selected.

Can we at least add an id attribute to tags or similar to this to identify difference and check the uniqueness based on this value?

Or maybe, you can check similarity based on tag data (whole object) and not just by name (value)

Most helpful comment

I'll fix this by tomorrow

All 4 comments

I'll fix this by tomorrow

Why aren't you changing the duplicates setting to true?

This will be good enough for now

It is difficult for Tagify to know if a tag is a duplicate or not based on what you're asking, since the user is simply typing something, and if the duplicates flag is set to false which means the program should not allow duplicates to be added or be suggested (in the dropdown) then how can Tagify know it's not a duplicate?

All the user has done was typing a word which already exist as a _tag_, and the typed word must be matched against something, and that something is the value property, because that's the only mandatory property. See the problem?

The only option would be to as I said earlier, changing the duplicates setting to true.

I re-reviewed my situation. There is 2 workarounds. First one changing value and append text other one is checking dupes on the backend.

Both ways, I decided to agree with you on this. Because, in the end, user will want to add a value that doesn't in autocomplete, This means only way to check dupes are with value

Thanks for looking into this, @yairEO.

Issue closed now.

Was this page helpful?
0 / 5 - 0 ratings