Skip to content

onCreateOption is not called, fails at valueArray[valueArray.length - 1] === newOption #3988

Closed
@euvs

Description

@euvs

Getting a weird bug at this line.

if (valueArray[valueArray.length - 1] === newOption) {

It seems that the === comparison fails on this line.

valueArray[valueArray.length - 1] === newOption

I put debugger breakpoint and inspected the values. Please see the console output.

> valueArray[valueArray.length - 1] === newOption
false
> newOption === newValue 
false
> newOption
{label: "Create "sd"", value: "sd", __isNew__: true}
> newValue
{label: "Create "sd"", value: "sd", __isNew__: true}
> valueArray
[{…}]0: {label: "Create "sd"", value: "sd", __isNew__: true}length: 1__proto__: Array(0)
> valueArray.length
1

It looks like the newOption and newValue have the same content by they fail when compared using === operator. As the result the onCreateOption is not called.

Metadata

Metadata

Labels

issue/bug-confirmedIssues about a bug that has been confirmed by a maintainerissue/has-prIssue has a PR attached to it that may solve the issueissue/reviewedIssue has recently been reviewed (mid-2020)

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions