Skip to content

TagInput value wrong when allow-duplicates is disabled #2608

Description

@darzove

Overview of the problem

Buefy version: [0.8.20]
Vuejs version: [2.6.11]
OS/Browser: Windows 10/Chrome

Description

When allow-duplicates is disabled (default), and autocomplete is enabled, entering a value twice will remove the tag from UI.
However the variable bound with v-model is not updated.

Steps to reproduce

  1. Navigate to https://buefy.org/documentation/taginput#autocomplete
  2. Ensure Allow new tags is disabled
  3. Enter George, press enter button
  4. Repeat step 3
  5. Variable bound to v-model still retains the data for George, but the tag is not present.

Expected behavior

The variable bound in v-model to reflect what is indicated in the UI.

Actual behavior

The data for George only disappears if more tags are added or removed - but the state is inconsistent unless action is taken.

Activity

  1. DmytroKuznyetsov commented on Jul 9, 2020

    @DmytroKuznyetsov

    Сaught the same issue

  2. marcebdev commented on Jul 10, 2020

    @marcebdev

    Same issue, I've written my own validator for the time being using :before-adding.

  3. Thaurin commented on Jul 13, 2020

    @Thaurin

    Yes, I've run into this as well. Trying to work around it like @marcebdev but hoping for an official fix soon!

  4. daniandl commented on Jul 13, 2020

    @daniandl

    From my own findings, this also happens when you simply click on the already-selected option in the autocomplete again. This removes it from the UI but doesn't update the model or call any events (input/remove).

  5. Thaurin commented on Jul 13, 2020

    @Thaurin

    Crap, you're right. I thought I could catch the remove event for this, but it doesn't get fired at all. I'm wondering how to fix it using :before-adding as marcebdev said, because I don't see how as it also doesn't get called upon second selection.

    Interestingly, the model gets corrected when a different new value is added: the value that was removed from UI by the second add is then also removed from the model.

  6. daniandl commented on Jul 13, 2020

    @daniandl

    Interestingly, the model gets corrected when a different new value is added: the value that was removed from UI by the second add is then also removed from the model.

    I think this is some sort of reactivity caveat, I don't really have time to inspect it any further at the moment sadly

  7. Thaurin commented on Jul 13, 2020

    @Thaurin

    Same here, so I'll live with this bug for now. There seem to be a few more issues with the TagInput component that I can't figure out getting mysterious "Duplicate keys" warnings from Vue, but am not yet sure if it's me or the component.

  8. Thaurin commented on Jul 13, 2020

    @Thaurin

    My other issue with the TagInput component mentioned above can be reproduced in this CodeSandbox. I made a new issue for it: #2673.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions