Skip to content

Commit 1fe567a

Browse files
Merge pull request #1020 from hlin-neo4j/953-boolean-param-select
Fixed booleans for parameter select (#953)
2 parents 1241c7a + 979c38d commit 1fe567a

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/chart/parameter/component/NodePropertyParameterSelect.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,9 @@ const NodePropertyParameterSelectComponent = (props: ParameterSelectProps) => {
118118
newValue.push(RenderSubValue(val));
119119
}
120120
} else if (!isMulti) {
121-
newValue = extraRecords.filter((r) => (r?._fields?.[displayValueRowIndex]?.toString() || null) == newDisplay)[0]
121+
// if records are toStringed before comparison, toString the comparing variable
122+
const newDisplay2 = typeof newDisplay === 'boolean' ? newDisplay.toString() : newDisplay;
123+
newValue = extraRecords.filter((r) => (r?._fields?.[displayValueRowIndex]?.toString() || null) == newDisplay2)[0]
122124
._fields[realValueRowIndex];
123125

124126
newValue =
@@ -165,8 +167,13 @@ const NodePropertyParameterSelectComponent = (props: ParameterSelectProps) => {
165167
/>
166168
);
167169
}
168-
let options = extraRecords?.map((r) => r?._fields?.[displayValueRowIndex] || '(no data)');
170+
171+
// "false" will not be mapped to "(no data)"
172+
let options = extraRecords
173+
?.map((r) => r?._fields?.[displayValueRowIndex])
174+
.map((f) => (f === undefined || f === null ? '(no data)' : f));
169175
options = props.autoSort ? options.sort() : options;
176+
170177
return (
171178
<div className={'n-flex n-flex-row n-flex-wrap n-items-center'}>
172179
<Autocomplete

0 commit comments

Comments
 (0)