Skip to content

[ENG-1860] Add Roam manual refresh for imported nodes - #1279

Open
sid597 wants to merge 2 commits into
eng-2022-make-roam-publishing-sync-independent-with-complete-nodefrom
eng-1860-add-roam-manual-refresh-for-imported-nodes
Open

[ENG-1860] Add Roam manual refresh for imported nodes#1279
sid597 wants to merge 2 commits into
eng-2022-make-roam-publishing-sync-independent-with-complete-nodefrom
eng-1860-add-roam-manual-refresh-for-imported-nodes

Conversation

@sid597

@sid597 sid597 commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator
eng-1860.mp4

Adds a manual refresh path for imported cross-app nodes in Roam. Pages carrying stored importedFrom source identity get a Refresh button in the page-title additions (gated on the same node-sharing flag as the import entry point). Clicking it re-fetches the latest shared content by the stored sourceNodeRid — never by the local title — and overwrites the local page through the existing materializeSharedNode update path, which preserves identity props, renames on title drift, and never duplicates. This mirrors the Obsidian per-note refresh (refreshImportedFile).

Two pieces of infra: getSharedNodeByRid in packages/database fetches one shared node by rid with targeted queries (space by url, then the concept/direct/full rows), reusing buildSharedNodes; and materializeSharedNode gains an opt-in force that bypasses the up-to-date skip, since a manual refresh must restore source content even when stored timestamps say current (MVP0: imported local edits are overwritten by refresh). The outcome surfaces as one toast; materialization failures and unexpected errors also go to PostHog. If the stored rid resolves to a different page holding the same identity, refresh reports that instead of claiming success on the clicked page.

The button check runs outside the discourse-node gate in the H1 observer so imported pages whose titles don't match local node formats still get the button. Refreshing a source with no full content yields a title-only page, matching import's existing (tested) behavior. Refresh-all is ENG-1861, provenance indicators ENG-1875.

Scope check

  • Ran $scope-check against ENG-1860 and the final diff.
  • Scope beyond Done When: None.

Open in Devin Review

@linear-code

linear-code Bot commented Aug 7, 2026

Copy link
Copy Markdown

ENG-1860

@vercel

vercel Bot commented Aug 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
discourse-graph Ready Ready Preview Aug 11, 2026 6:18pm

Request Review

@graphite-app

graphite-app Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

PR size/scope check

This PR is over our review-size guideline.

  • Recommended: ~200 lines changed
  • Acceptable limit: up to 400 lines when well-scoped/self-contained
  • Preferred file count: fewer than 5 files

Please split this into smaller PRs unless there is a clear reason the changes need to land together.

If keeping it as one PR, please add a brief justification covering:

  • What single problem this PR solves
  • Why the files/changes are coupled

@supabase

supabase Bot commented Aug 7, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project zytfjzqyijgagqxrzbmz because there are no changes detected in packages/database/supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4cef87b2f2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +287 to +291
.from("my_contents")
.select(DIRECT_CONTENT_COLUMNS)
.eq("space_id", space.id)
.eq("source_local_id", sourceLocalId)
.eq("variant", "direct"),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Select only the original direct-content row

When a source has a derived (original = NULL) direct representation alongside its original direct content—a layout explicitly allowed by the content uniqueness indexes—this query returns both rows. buildSharedNodes then collapses them using last-write-wins map insertion with no ordering, so a refresh can nondeterministically use the derived text as the page title and rename the imported page incorrectly. Restrict this lookup to original = true, as the subsequent full-Markdown fetch already does.

Useful? React with 👍 / 👎.

@sid597
sid597 force-pushed the eng-1860-add-roam-manual-refresh-for-imported-nodes branch from 4cef87b to 11446f6 Compare August 7, 2026 07:01
@sid597
sid597 changed the base branch from main to eng-2022-make-roam-publishing-sync-independent-with-complete-node August 7, 2026 07:01
@sid597
sid597 force-pushed the eng-1860-add-roam-manual-refresh-for-imported-nodes branch from 11446f6 to 9f74a1a Compare August 10, 2026 05:40
sid597 added 2 commits August 11, 2026 23:47
ENG-2022 made node-sharing features sync-independent; the import and
publish entry points gate on Enable node sharing, so the refresh button
for imported nodes must too.
@sid597
sid597 force-pushed the eng-1860-add-roam-manual-refresh-for-imported-nodes branch from 2f76c20 to b47167e Compare August 11, 2026 18:17
@sid597
sid597 requested a review from maparent August 11, 2026 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant