Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(md): wrap mention menu history query in suspense (#896)

Seamusbed972ad098b
diff --git a/js/app/packages/core/component/LexicalMarkdown/component/menu/MentionsMenu.tsx b/js/app/packages/core/component/LexicalMarkdown/component/menu/MentionsMenu.tsx
index 85936f5aa9..fb30a9ed1b 100644
--- a/js/app/packages/core/component/LexicalMarkdown/component/menu/MentionsMenu.tsx
+++ b/js/app/packages/core/component/LexicalMarkdown/component/menu/MentionsMenu.tsx
@@ -44,8 +44,10 @@ import {
onMount,
type ParentProps,
Show,
+ Suspense,
untrack,
} from 'solid-js';
+import { Dynamic } from 'solid-js/web';
import { floatWithElement } from '../../directive/floatWithElement';
import { floatWithSelection } from '../../directive/floatWithSelection';
import {
@@ -385,7 +387,15 @@ export function MentionsMenuItem(props: {
);
}
-export function MentionsMenu(props: {
+export function MentionsMenu(props: Parameters<typeof MentionsMenuInner>[0]) {
+ return (
+ <Suspense>
+ <MentionsMenuInner {...props} />
+ </Suspense>
+ );
+}
+
+function MentionsMenuInner(props: {
editor: LexicalEditor;
menu: MenuOperations;
/** pass in custom history list if necessary */
@@ -1033,7 +1043,7 @@ export function MentionsMenu(props: {
dates.length +
emailList.length;
- const renderOptions = createMemo(() => {
+ const RenderOptions = () => {
const options = [];
if (users.length > 0) {
options.push(
@@ -1155,14 +1165,16 @@ export function MentionsMenu(props: {
</>
)
);
- });
+ };
return (
<Show
when={totalLength() > 0}
fallback={<div class="px-2 text-ink-extra-muted">No results</div>}
>
- <div>{renderOptions()}</div>
+ <div>
+ <Dynamic component={RenderOptions} />
+ </div>
</Show>
);
});
diff --git a/js/app/packages/queries/history/history.ts b/js/app/packages/queries/history/history.ts
index 500b589fbf..85c8aea517 100644
--- a/js/app/packages/queries/history/history.ts
+++ b/js/app/packages/queries/history/history.ts
@@ -52,6 +52,7 @@ export function useHistoryQuery(options?: {
return useQuery(() => ({
...historyQueryOptions(),
+ placeholderData: (prev) => prev,
select: (data: HistoryQueryResponse): HistoryItem[] => {
const instructionsId = instructionsIdQuery.isSuccess
? instructionsIdQuery.data