Skip to content

BasePicker createGenericItem creates nested structure #3509

Description

@ohritz

Bug Report

  • Package version(s): 5.29.0

Priorities and help requested (not applicable if asking question):

Are you willing to submit a PR to fix? Yes

Requested priority: High

Describe the issue:

Using the createGenericItem on the TagPicker, the typing calls for it to return a ISuggestionModel, doing so results in the new "tag"/item to have the structure of a ISuggestionModel<T> instead of T

The issue stems from BasePicker._onValidateInput() calls this.props.createGenericItem, which is expected to return a ISuggestionModel<T> (but it has been typed as any... )
It then proceeds to call suggestionStore.createGenericSuggestion with the item returned from the callback.
In the Suggestions controller, the item passed is "converted" into a ISuggestionModel<T>

making the structrue as such:

ISuggestionModel<T> {
   item: ISuggestinModel<T> {
      item: T;
      selected: boolean;
   }
}

Actual behavior:

creating a generic item, adds a ISuggestionModel<ISuggestionModel<T>> instead of an item<T> in the items list of the picker.

Expected behavior:

creating a generic item, adds a an item<T> in the items list of the picker.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions