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(block-md): update document title live when another person changes it (#8331)

Jacob Beckerman5659397990b0
diff --git a/apps/web/src/features/drive-view/views/MarkdownDetail.tsx b/apps/web/src/features/drive-view/views/MarkdownDetail.tsx
index 8dc73ba6e9..e55edf1f14 100644
--- a/apps/web/src/features/drive-view/views/MarkdownDetail.tsx
+++ b/apps/web/src/features/drive-view/views/MarkdownDetail.tsx
@@ -24,6 +24,7 @@ import { ENABLE_MARKDOWN_SIDE_PANEL } from '@core/constant/featureFlags';
import { createMethodRegistration } from '@core/orchestrator';
import { DocumentDebouncedNotificationReadMarker } from '@notifications';
import SpinnerIcon from '@phosphor/spinner.svg';
+import { useItemRawName } from '@queries/preview';
import { Button } from '@ui';
import { createComputed, type JSX, Match, Show, Switch } from 'solid-js';
import { FileDetailLoadGate } from '../components/FileDetail';
@@ -85,6 +86,14 @@ function MarkdownDetailContent(props: {
const state = createMarkdownDocumentState();
createMarkdownRouteNavigation(() => props.documentId, state.params.navigate);
+ // Subscribe to live name updates so the title updates when another person renames it.
+ const liveName = useItemRawName(() => ({
+ id: props.documentId,
+ type: 'document',
+ }));
+ const persistedName = () =>
+ liveName() ?? props.data.metadata.documentName ?? '';
+
// Mention chips and notifications aim an open document at a comment or node
// through its block handle; without one the click only activates the view.
createComputed(() => {
@@ -101,7 +110,7 @@ function MarkdownDetailContent(props: {
state={state}
documentSource={{ type: 'sync', source: props.data.source }}
permissions={props.data.permissions}
- persistedName={props.data.metadata.documentName}
+ persistedName={persistedName()}
fallbackName={props.fallbackName}
>
<ModalsProvider>