Skip to content
Snippets Groups Projects
Unverified Commit e23f9d82 authored by Matiss Janis Aboltins's avatar Matiss Janis Aboltins Committed by GitHub
Browse files

:bug: normalize value when switching between single/multi select (#855)

Closes #779

Normalize the input value when switching between single/multi select
fields. Most visible when using the "notes" field filter.
parent 6ef1f3d1
No related branches found
No related tags found
No related merge requests found
......@@ -244,7 +244,7 @@ function ConfigureField({
field={field}
subfield={subfield}
type={type === 'id' && op === 'contains' ? 'string' : type}
value={value}
value={normalizeValue(value, op === 'oneOf')}
multi={op === 'oneOf'}
style={{ marginTop: 10 }}
onChange={v => dispatch({ type: 'set-value', value: v })}
......@@ -530,3 +530,18 @@ export function AppliedFilters({ filters, editingFilter, onUpdate, onDelete }) {
</View>
);
}
function normalizeValue(value, isMulti) {
if (isMulti) {
if (Array.isArray(value)) {
return value;
}
return value.split(', ');
}
if (Array.isArray(value)) {
return value.join(', ');
}
return value;
}
---
category: Bugfix
authors: [MatissJanis]
---
Normalize value when single/multi select is changed
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment