fix(education): improve some settings to make champ education more reliable
This commit is contained in:
parent
fe37f1acfe
commit
91b398d039
4 changed files with 14 additions and 9 deletions
|
@ -427,14 +427,15 @@ export const createLoader: (
|
|||
});
|
||||
if (response.ok) {
|
||||
const json = await response.json();
|
||||
const [err, result] = s.validate(json, s.array(Item), { coerce: true });
|
||||
const [err, items] = s.validate(json, s.array(Item), { coerce: true });
|
||||
if (!err) {
|
||||
const items = matchSorter(result, filterText, {
|
||||
keys: ['label']
|
||||
});
|
||||
return {
|
||||
items: limit ? items.slice(0, limit) : items
|
||||
};
|
||||
if (items.length > limit) {
|
||||
const filteredItems = matchSorter(items, filterText, {
|
||||
keys: ['label']
|
||||
});
|
||||
return { items: filteredItems.slice(0, limit) };
|
||||
}
|
||||
return { items };
|
||||
}
|
||||
}
|
||||
return { items: [] };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue