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: don't cache blame 404s + add suspense to blame (#4466)

Wolf Mermelsteinb8d08e965fe4
diff --git a/js/app/packages/block-md/component/MarkdownEditor.tsx b/js/app/packages/block-md/component/MarkdownEditor.tsx
index 19c0fddcb4..aaa0bfae73 100644
--- a/js/app/packages/block-md/component/MarkdownEditor.tsx
+++ b/js/app/packages/block-md/component/MarkdownEditor.tsx
@@ -179,6 +179,7 @@ import {
on,
onCleanup,
Show,
+ Suspense,
untrack,
} from 'solid-js';
import {
@@ -1017,7 +1018,9 @@ export function MarkdownEditor(props: {
</div>
</Show>
<Show when={ENABLE_GIT_BLAME()}>
- <BlameTooltip state={blameTooltipStore} documentId={blockId} />
+ <Suspense>
+ <BlameTooltip state={blameTooltipStore} documentId={blockId} />
+ </Suspense>
</Show>
<DecoratorRenderer editor={editor} />
<NodeAccessoryRenderer editor={editor} store={accessoryStore} />
diff --git a/js/app/packages/core/component/LexicalMarkdown/plugins/blame-tooltip/BlameTooltip.tsx b/js/app/packages/core/component/LexicalMarkdown/plugins/blame-tooltip/BlameTooltip.tsx
index 35e287a201..077a7fda77 100644
--- a/js/app/packages/core/component/LexicalMarkdown/plugins/blame-tooltip/BlameTooltip.tsx
+++ b/js/app/packages/core/component/LexicalMarkdown/plugins/blame-tooltip/BlameTooltip.tsx
@@ -79,7 +79,7 @@ export function BlameTooltip(props: {
onCleanup(hide);
return (
- <Show when={visible() && query.data?.userId ? query.data : null}>
+ <Show when={visible() && query.data?.userId ? query.data : undefined}>
{(b) => (
<div
class="fixed z-50 text-xs text-ink-secondary/70 pointer-events-none"
diff --git a/js/app/packages/queries/blame.ts b/js/app/packages/queries/blame.ts
index dedee40a13..c6b2b81c2d 100644
--- a/js/app/packages/queries/blame.ts
+++ b/js/app/packages/queries/blame.ts
@@ -1,21 +1,23 @@
import { ENABLE_GIT_BLAME } from '@core/constant/featureFlags';
import { syncServiceClient } from '@service-sync/client';
-import { createQuery } from '@tanstack/solid-query';
+import { useQuery } from '@tanstack/solid-query';
export function useNodeBlameQuery(
documentId: string,
nodeId: () => string | null
) {
- return createQuery(() => ({
+ return useQuery(() => ({
queryKey: ['blame', documentId, nodeId()],
queryFn: async () => {
const res = await syncServiceClient.getNodeBlame({
documentId,
nodeId: nodeId()!,
});
- return res.isOk() ? res.value : null;
+ if (!res.isOk()) throw new Error('blame_not_found');
+ return res.value;
},
enabled: ENABLE_GIT_BLAME() && nodeId() !== null,
staleTime: Infinity,
+ retry: false,
}));
}