Skip to content

Dropdown displayValue property #3122

@MiniMarPaz

Description

@MiniMarPaz

Hello.

Today playing with carbon i've noticed interesting thing with dropdown displayValue property. If for example I will pass displayValue property as undefined ( can happen in Javascript ) , this will break dropdown. This means no placeholder will be shown and ofcourse after selecting value , no value will be displayed.

Image

I've investigated source code a bit and found some interesting thing. If displayValue is not a type of string ( undefined is definitely not a string ) , You expect that displayValue will be <TemplateRef> . But in our case as displayValue is undefined and this breaks component.

Image

Image

The question is , maybe it is worth to create some kind of "safeguard" in this particular case? I mean if displayValue will be undefined , then just assign it empty string instead to avoid this kind of behaviour ? Because I believe those kidn of "bugs" can bring a lot of pain when debugging.

Thank You!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions