mirror of
https://github.com/strapi/strapi.git
synced 2026-01-06 04:03:25 +00:00
Fix ctb menu
Signed-off-by: soupette <cyril@strapi.io>
This commit is contained in:
parent
3aada6c5b8
commit
f647efefef
@ -154,31 +154,21 @@ const useContentTypeBuilderMenu = () => {
|
||||
|
||||
const getMenu = () => {
|
||||
// Maybe we can do it simpler with matchsorter wildcards ?
|
||||
return data
|
||||
.map(section => {
|
||||
const hasChild = section.links.some(l => !isEmpty(l.links));
|
||||
|
||||
if (hasChild) {
|
||||
return {
|
||||
...section,
|
||||
links: section.links.map(l => ({ ...l, links: matchByTitle(l.links) })),
|
||||
};
|
||||
}
|
||||
return data.map(section => {
|
||||
const hasChild = section.links.some(l => !isEmpty(l.links));
|
||||
|
||||
if (hasChild) {
|
||||
return {
|
||||
...section,
|
||||
links: matchByTitle(section.links),
|
||||
links: section.links.map(l => ({ ...l, links: matchByTitle(l.links) })),
|
||||
};
|
||||
})
|
||||
.filter(section => {
|
||||
const hasChildren = section.links.every(l => l.links);
|
||||
}
|
||||
|
||||
if (hasChildren) {
|
||||
return section.links.some(l => l.links.length);
|
||||
}
|
||||
|
||||
return section.links.length;
|
||||
});
|
||||
return {
|
||||
...section,
|
||||
links: matchByTitle(section.links),
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
return { menu: getMenu(), searchValue: search, onSearchChange: setSearch };
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user