Skip to content

Commit

Permalink
reactSelect: SelectionType.Multi.reader: handle null as Nil
Browse files Browse the repository at this point in the history
  • Loading branch information
nafg committed Jun 11, 2020
1 parent fb8e91b commit c111b75
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ object SelectionType {
}
implicit object Multi extends SelectionType[Seq] {
override implicit def writer[A](implicit A: Writer[A]): Writer[Seq[A]] = _.map(A.write).toJSArray
override implicit def reader[A](implicit A: Reader[A]): Reader[Seq[A]] =
_.asInstanceOf[js.Array[js.Object]].toSeq.map(A.read)
override implicit def reader[A](implicit A: Reader[A]): Reader[Seq[A]] = {
case null => Nil
case v => v.asInstanceOf[js.Array[js.Object]].toSeq.map(A.read)
}
override def defaultProps[A] = Seq(_.isClearable := true, _.isMulti := true)
override def toSeq[A](fa: Seq[A]) = fa
}
Expand Down

0 comments on commit c111b75

Please sign in to comment.