Skip to content

Commit

Permalink
Fixed the filter functionality when the parameter is a reference. (#33)
Browse files Browse the repository at this point in the history
Fixed : Failed prop type: Invalid prop children of type array supplied to `ReferenceFieldView`, expected a single ReactElement.
  • Loading branch information
Antonio171003 authored Sep 4, 2024
1 parent d04a78c commit 8464133
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ object ListGuesser {
val component: FunctionalComponent[Props] = FunctionalComponent[Props] { props =>
val fields = ResponseGuesser.getTypesFromResponse(props.response)

def defaultField(reference: String, source: String)(children: ReactElement*): ReactElement =
def defaultField(reference: String, source: String)(children: ReactElement): ReactElement =
ReferenceField(reference = reference, source = source)(children)

val widgetFields: Seq[ReactElement] = fields.map { field =>
Expand Down Expand Up @@ -49,7 +49,14 @@ object ListGuesser {
case ColumnType.Image => Fragment()
case ColumnType.Number => NumberInput(source = field.name)
case ColumnType.Reference(reference, source) =>
defaultField(reference, field.name)(TextField(source = source))
ReferenceInput(
source = field.name,
reference = reference
)(
SelectInput(
optionText = props.response.referenceDisplayField.getOrElse(source)
)
)
}
}

Expand Down

0 comments on commit 8464133

Please sign in to comment.