Skip to content

Value labels are lost when options are loading asynchronously #511

@oluckyman

Description

@oluckyman

Consider example:
You have a multi-select with async options.

  • User clicks on placeholder and now the input is focused
  • User types "a" keystroke.
  • asyncOptions are loading options for query "a"
this.state.options == [ { value: 1, label: 'AAA' }, { value: 2, label: 'AAB' } ]
  • User selects from the list option AAA
  • value become value: "1"
  • Input contains selected option [AAA] and input is focused
  • User types "z" keystroke.
  • asyncOptions are loading options for query "z"
this.state.options == [ { value: 9, label: 'ZZZ' } ]
  • User selects from the list option ZZZ
  • value become value: "1,9"

And now the initValuesArray called with value = [1, 9] and options = [ { value: 9, label: 'ZZZ' } ]
So it can resolve label for value 9 but can’t resolve label for value 1. And as a result user has [1] [ZZZ] instead of [AAA] [ZZZ] in the input.
example

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions