dbug fe: separate list query term with space

Allows searching for multiple parts of the item key separately,
returning only items that match all.
This commit is contained in:
Fang 2020-05-21 18:03:56 +02:00
parent d218541e4f
commit 6ae326470a
No known key found for this signature in database
GPG Key ID: EB035760C1BBA972

View File

@ -32,7 +32,9 @@ export class SearchableList extends Component {
);
let items = props.items.filter(item => {
return (state.query === '') || item.key.includes(state.query);
return state.query.split(' ').reduce((match, query) => {
return match && item.key.includes(query);
}, true);
})
if (items.length === 0) {
items = 'none';