Skip to content

Commit

Permalink
Fixed booleans for parameter select (neo4j-labs#953)
Browse files Browse the repository at this point in the history
  • Loading branch information
hlin-neo4j committed Jan 2, 2025
1 parent c909b59 commit 979c38d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/chart/parameter/component/NodePropertyParameterSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ const NodePropertyParameterSelectComponent = (props: ParameterSelectProps) => {
newValue.push(RenderSubValue(val));
}
} else if (!isMulti) {
newValue = extraRecords.filter((r) => (r?._fields?.[displayValueRowIndex]?.toString() || null) == newDisplay)[0]
// if records are toStringed before comparison, toString the comparing variable
const newDisplay2 = typeof newDisplay === 'boolean' ? newDisplay.toString() : newDisplay;
newValue = extraRecords.filter((r) => (r?._fields?.[displayValueRowIndex]?.toString() || null) == newDisplay2)[0]
._fields[realValueRowIndex];

newValue =
Expand Down Expand Up @@ -165,8 +167,13 @@ const NodePropertyParameterSelectComponent = (props: ParameterSelectProps) => {
/>
);
}
let options = extraRecords?.map((r) => r?._fields?.[displayValueRowIndex] || '(no data)');

// "false" will not be mapped to "(no data)"
let options = extraRecords
?.map((r) => r?._fields?.[displayValueRowIndex])
.map((f) => (f === undefined || f === null ? '(no data)' : f));
options = props.autoSort ? options.sort() : options;

return (
<div className={'n-flex n-flex-row n-flex-wrap n-items-center'}>
<Autocomplete
Expand Down

0 comments on commit 979c38d

Please sign in to comment.