Ensure both people and documents are showin in mention menu with no search term

This commit is contained in:
Tom Moor committed 2025-01-18 14:51:40 -05:00
1 parent 64106979ba
commit cfdb213cc1
1 file changed
+4 -1
+4 -1
View File
@@ -46,6 +46,8 @@ function MentionMenu({ search, isActive, ...rest }: Props) {
const actorId = auth.currentUserId;
const location = useLocation();
const documentId = parseDocumentSlug(location.pathname);
const maxResultsInSection = search ? 25 : 5;
const { data, loading, request } = useRequest<{
documents: Document[];
users: User[];
@@ -69,6 +71,7 @@ function MentionMenu({ search, isActive, ...rest }: Props) {
React.useEffect(() => {
if (data && actorId && !loading) {
const items = data.users
.slice(0, maxResultsInSection)
.map(
(user) =>
({
@@ -100,7 +103,7 @@ function MentionMenu({ search, isActive, ...rest }: Props) {
} as MentionItem)
)
.concat(
data.documents.map(
data.documents.slice(0, maxResultsInSection).map(
(doc) =>
({
name: "mention",