feat: change includes to startsWith in CM & CTB

This commit is contained in:
Josh 2023-04-18 11:10:51 +01:00
parent ef4f3b64fe
commit 802f880729
2 changed files with 5 additions and 5 deletions

View File

@ -27,7 +27,7 @@ const LeftMenu = () => {
const modelLinksSelector = useMemo(makeSelectModelLinks, []); const modelLinksSelector = useMemo(makeSelectModelLinks, []);
const { collectionTypeLinks, singleTypeLinks } = useSelector(modelLinksSelector, shallowEqual); const { collectionTypeLinks, singleTypeLinks } = useSelector(modelLinksSelector, shallowEqual);
const { includes } = useFilter(locale, { const { startsWith } = useFilter(locale, {
sensitivity: 'base', sensitivity: 'base',
}); });
@ -65,7 +65,7 @@ const LeftMenu = () => {
/** /**
* Filter by the search value * Filter by the search value
*/ */
.filter((link) => includes(link.title, search)) .filter((link) => startsWith(link.title, search))
/** /**
* Sort correctly using the language * Sort correctly using the language
*/ */
@ -80,7 +80,7 @@ const LeftMenu = () => {
}; };
}), }),
})), })),
[collectionTypeLinks, search, singleTypeLinks, includes, formatMessage, formatter] [collectionTypeLinks, search, singleTypeLinks, startsWith, formatMessage, formatter]
); );
const handleClear = () => { const handleClear = () => {

View File

@ -25,7 +25,7 @@ const useContentTypeBuilderMenu = () => {
const { onOpenModalCreateSchema, onOpenModalEditCategory } = useFormModalNavigation(); const { onOpenModalCreateSchema, onOpenModalEditCategory } = useFormModalNavigation();
const { locale } = useIntl(); const { locale } = useIntl();
const { includes } = useFilter(locale, { const { startsWith } = useFilter(locale, {
sensitivity: 'base', sensitivity: 'base',
}); });
@ -186,7 +186,7 @@ const useContentTypeBuilderMenu = () => {
return { return {
...section, ...section,
links: section.links links: section.links
.filter((link) => includes(link.title, search)) .filter((link) => startsWith(link.title, search))
.sort((a, b) => formatter.compare(a.title, b.title)), .sort((a, b) => formatter.compare(a.title, b.title)),
}; };
}); });