From 171e44d3a53e14fa4db1d9292276057a2bb920f9 Mon Sep 17 00:00:00 2001 From: Trang Doan Date: Mon, 22 Jun 2026 11:59:33 -0400 Subject: [PATCH 1/2] fix first bug: overlay not showing any information --- apps/roam/src/utils/matchDiscourseNode.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/roam/src/utils/matchDiscourseNode.ts b/apps/roam/src/utils/matchDiscourseNode.ts index d0f652497..f0e05522b 100644 --- a/apps/roam/src/utils/matchDiscourseNode.ts +++ b/apps/roam/src/utils/matchDiscourseNode.ts @@ -20,9 +20,10 @@ const matchDiscourseNode = ({ )) => { // Handle specification with single "has title" clause if ( - specification.length === 1 && - specification[0].type === "clause" && - specification[0].relation === "has title" + specification?.length === 1 && + specification[0]?.type === "clause" && + specification[0]?.relation === "has title" && + specification[0]?.target ) { const title = "title" in rest ? rest.title : getPageTitleByPageUid(rest.uid); From 29eebfce4379cb6d79f058934aca5771f7a513bc Mon Sep 17 00:00:00 2001 From: Trang Doan Date: Mon, 22 Jun 2026 19:36:32 -0400 Subject: [PATCH 2/2] ENG-1711 Refresh open discourse contexts on relation mutations Trigger targeted discourse-context refreshes for affected source/destination UIDs after create/delete so mounted views update immediately, while preserving cached behavior for passive loads. Co-authored-by: Cursor --- .../src/components/CreateRelationDialog.tsx | 27 ++++++++----- apps/roam/src/components/DiscourseContext.tsx | 40 +++++++++++++++++-- .../components/DiscourseContextOverlay.tsx | 2 - .../components/results-view/ResultsTable.tsx | 5 ++- .../utils/discourseContextMutationRefresh.ts | 25 ++++++++++++ 5 files changed, 82 insertions(+), 17 deletions(-) create mode 100644 apps/roam/src/utils/discourseContextMutationRefresh.ts diff --git a/apps/roam/src/components/CreateRelationDialog.tsx b/apps/roam/src/components/CreateRelationDialog.tsx index 811995c6c..0ba283129 100644 --- a/apps/roam/src/components/CreateRelationDialog.tsx +++ b/apps/roam/src/components/CreateRelationDialog.tsx @@ -24,9 +24,10 @@ import type { Result } from "~/utils/types"; import internalError from "~/utils/internalError"; import getDiscourseNodes from "~/utils/getDiscourseNodes"; import posthog from "posthog-js"; +import { refreshDiscourseContextsForMutatedUids } from "~/utils/discourseContextMutationRefresh"; export type CreateRelationDialogProps = { - onClose: () => void; + onClose: (created?: boolean) => void; sourceNodeUid: string; }; @@ -159,12 +160,18 @@ const CreateRelationDialog = ({ if (selectedTargetUid === "") return false; const relation = identifyRelationMatch(selectedTargetText); if (relation === null) return false; + const sourceUid = relation.forward ? sourceNodeUid : selectedTargetUid; + const destinationUid = relation.forward ? selectedTargetUid : sourceNodeUid; const result = await createReifiedRelation({ relationBlockUid: relation.id, - sourceUid: relation.forward ? sourceNodeUid : selectedTargetUid, - destinationUid: relation.forward ? selectedTargetUid : sourceNodeUid, + sourceUid, + destinationUid, }); - return result !== undefined; + if (result === undefined) return false; + refreshDiscourseContextsForMutatedUids({ + uids: [sourceNodeUid, selectedTargetUid], + }); + return true; }; const onCreateSync = (): void => { @@ -173,8 +180,8 @@ const CreateRelationDialog = ({ hasTarget: !!selectedTargetUid, }); onCreate() - .then((result: boolean) => { - if (result) { + .then((created) => { + if (created) { renderToast({ id: `discourse-relation-created-${Date.now()}`, intent: "success", @@ -188,7 +195,7 @@ const CreateRelationDialog = ({ content: Failed to create relation, }); } - onClose(); + onClose(created); }) .catch(() => { renderToast({ @@ -196,7 +203,7 @@ const CreateRelationDialog = ({ intent: "danger", content: Failed to create relation, }); - onClose(); + onClose(false); }); }; @@ -227,7 +234,7 @@ const CreateRelationDialog = ({ return ( onClose(false)} autoFocus={false} className="roamjs-canvas-dialog" > @@ -264,7 +271,7 @@ const CreateRelationDialog = ({
-