Do not duplicate dropdown option entry if it already exists#175
Do not duplicate dropdown option entry if it already exists#175joakim-ribier wants to merge 1 commit intorivo:masterfrom
Conversation
|
Hi, thank you for contributing to I have trouble understanding why you would like this functionality to be part of this package. I am not sure that users will expect this behaviour from the Maybe you could provide an example where the current |
|
Hi, Actually, there is no directly a problem with the lib, i just thought it was more convenient to avoid entry duplicates directly in the primitive and not in my app side... It's a bit heavy for each dropdown to check that it is not possible to add twice the same value :-) |
|
I can't think of a situation where one would accidentally add the same value twice. Can you give me an example where this happens for you? |
|
Hi, For the little context, to make my first app with the Go language, i try to impement my first text ui application with tview library. It's a rich http client. So, my user needs to add header value in his request. For that, i implement a dropdown which list header values and an inputtext for adding a new value by the user. So, if user adds twice the same value (for example my user clicks twice on "save" button on first screenshot), then, the dropdown contains now, several times the x value. I think it's my own problem and not a library specifc solution for that...maybe the user may want a duplicate or not entry in the dropdown primitive 👍 You can close the PR 😃 |
|
I would actually agree with you here that this functionality should be part of your application rather than the set := make(map[string]struct{})Then you also add your entry to this set: I'll close this PR now. If you have any more questions, feel free to post them here. I read them. |


Hi,
I propose this little fix (feature) for to not add a duplicate entry to a dropdown widget if the text already exists.
Sorry for advance, i don't know if this is the right way to proceed...
Thanks