diff --git a/app/editor/components/MentionMenu.tsx b/app/editor/components/MentionMenu.tsx
index da341bdf8a..7e916dedb1 100644
--- a/app/editor/components/MentionMenu.tsx
+++ b/app/editor/components/MentionMenu.tsx
@@ -82,154 +82,153 @@ function MentionMenu({ search, isActive, ...rest }: Props) {
// Computed in the render body so MobX observer can track store access
// (e.g. searchSuppressed). Previously this lived inside a useEffect which
// runs outside the reactive context and triggered MobX warnings.
- const items: MentionItem[] =
- actorId && !loading
- ? users
- .findByQuery(search, { maxResults: maxResultsInSection })
- .map(
- (user) =>
- ({
- name: "mention",
- icon: (
-
-
-
- ),
- title: user.name,
- section: UserSection,
- appendSpace: true,
- attrs: {
- id: uuidv4(),
- type: MentionType.User,
- modelId: user.id,
- actorId,
- label: user.name,
- },
- }) as MentionItem
- )
- .concat(
- groups
- .findByQuery(search, { maxResults: maxResultsInSection })
- .map((group) => ({
- name: "mention",
- icon: (
-
-
-
- ),
- title: group.name,
- subtitle: t("{{ count }} members", {
- count: group.memberCount,
- }),
- section: GroupSection,
- appendSpace: true,
- attrs: {
- id: uuidv4(),
- type: MentionType.Group,
- modelId: group.id,
- actorId,
- label: group.name,
- },
- }))
- )
- .concat(
- documents
- .findByQuery(search, { maxResults: maxResultsInSection })
- .map(
- (doc) =>
- ({
- name: "mention",
- icon: doc.icon ? (
-
- ) : (
-
- ),
- title: doc.title,
- subtitle: doc.collectionId ? (
-
- ) : undefined,
- section: DocumentsSection,
- appendSpace: true,
- attrs: {
- id: uuidv4(),
- type: MentionType.Document,
- modelId: doc.id,
- actorId,
- label: doc.title,
- },
- }) as MentionItem
- )
- )
- .concat(
- collections
- .findByQuery(search, { maxResults: maxResultsInSection })
- .map(
- (collection) =>
- ({
- name: "mention",
- icon: collection.icon ? (
-
- ) : (
-
- ),
- title: collection.name,
- section: CollectionsSection,
- appendSpace: true,
- attrs: {
- id: uuidv4(),
- type: MentionType.Collection,
- modelId: collection.id,
- actorId,
- label: collection.name,
- },
- }) as MentionItem
- )
- )
- .concat([
- {
- name: "link",
- icon: ,
- title: search?.trim(),
- section: DocumentsSection,
- subtitle: t("Create a new doc"),
- visible: !!search && !isEmail(search),
- priority: -1,
+ const items: MentionItem[] = actorId
+ ? users
+ .findByQuery(search, { maxResults: maxResultsInSection })
+ .map(
+ (user) =>
+ ({
+ name: "mention",
+ icon: (
+
+
+
+ ),
+ title: user.name,
+ section: UserSection,
appendSpace: true,
attrs: {
id: uuidv4(),
- type: MentionType.Document,
- modelId: uuidv4(),
+ type: MentionType.User,
+ modelId: user.id,
actorId,
- label: search,
+ label: user.name,
},
- } as MentionItem,
- ])
- : [];
+ }) as MentionItem
+ )
+ .concat(
+ groups
+ .findByQuery(search, { maxResults: maxResultsInSection })
+ .map((group) => ({
+ name: "mention",
+ icon: (
+
+
+
+ ),
+ title: group.name,
+ subtitle: t("{{ count }} members", {
+ count: group.memberCount,
+ }),
+ section: GroupSection,
+ appendSpace: true,
+ attrs: {
+ id: uuidv4(),
+ type: MentionType.Group,
+ modelId: group.id,
+ actorId,
+ label: group.name,
+ },
+ }))
+ )
+ .concat(
+ documents
+ .findByQuery(search, { maxResults: maxResultsInSection })
+ .map(
+ (doc) =>
+ ({
+ name: "mention",
+ icon: doc.icon ? (
+
+ ) : (
+
+ ),
+ title: doc.title,
+ subtitle: doc.collectionId ? (
+
+ ) : undefined,
+ section: DocumentsSection,
+ appendSpace: true,
+ attrs: {
+ id: uuidv4(),
+ type: MentionType.Document,
+ modelId: doc.id,
+ actorId,
+ label: doc.title,
+ },
+ }) as MentionItem
+ )
+ )
+ .concat(
+ collections
+ .findByQuery(search, { maxResults: maxResultsInSection })
+ .map(
+ (collection) =>
+ ({
+ name: "mention",
+ icon: collection.icon ? (
+
+ ) : (
+
+ ),
+ title: collection.name,
+ section: CollectionsSection,
+ appendSpace: true,
+ attrs: {
+ id: uuidv4(),
+ type: MentionType.Collection,
+ modelId: collection.id,
+ actorId,
+ label: collection.name,
+ },
+ }) as MentionItem
+ )
+ )
+ .concat([
+ {
+ name: "link",
+ icon: ,
+ title: search?.trim(),
+ section: DocumentsSection,
+ subtitle: t("Create a new doc"),
+ visible: !!search && !isEmail(search),
+ priority: -1,
+ appendSpace: true,
+ attrs: {
+ id: uuidv4(),
+ type: MentionType.Document,
+ modelId: uuidv4(),
+ actorId,
+ label: search,
+ },
+ } as MentionItem,
+ ])
+ : [];
const handleSelect = useCallback(
async (item: MentionItem) => {