mirror of
https://github.com/strapi/strapi.git
synced 2025-09-25 16:29:34 +00:00
feat: change includes to startsWith in CM & CTB
This commit is contained in:
parent
ef4f3b64fe
commit
802f880729
@ -27,7 +27,7 @@ const LeftMenu = () => {
|
||||
const modelLinksSelector = useMemo(makeSelectModelLinks, []);
|
||||
const { collectionTypeLinks, singleTypeLinks } = useSelector(modelLinksSelector, shallowEqual);
|
||||
|
||||
const { includes } = useFilter(locale, {
|
||||
const { startsWith } = useFilter(locale, {
|
||||
sensitivity: 'base',
|
||||
});
|
||||
|
||||
@ -65,7 +65,7 @@ const LeftMenu = () => {
|
||||
/**
|
||||
* Filter by the search value
|
||||
*/
|
||||
.filter((link) => includes(link.title, search))
|
||||
.filter((link) => startsWith(link.title, search))
|
||||
/**
|
||||
* 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 = () => {
|
||||
|
@ -25,7 +25,7 @@ const useContentTypeBuilderMenu = () => {
|
||||
const { onOpenModalCreateSchema, onOpenModalEditCategory } = useFormModalNavigation();
|
||||
const { locale } = useIntl();
|
||||
|
||||
const { includes } = useFilter(locale, {
|
||||
const { startsWith } = useFilter(locale, {
|
||||
sensitivity: 'base',
|
||||
});
|
||||
|
||||
@ -186,7 +186,7 @@ const useContentTypeBuilderMenu = () => {
|
||||
return {
|
||||
...section,
|
||||
links: section.links
|
||||
.filter((link) => includes(link.title, search))
|
||||
.filter((link) => startsWith(link.title, search))
|
||||
.sort((a, b) => formatter.compare(a.title, b.title)),
|
||||
};
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user