Skip to content

ENG-1842 Strip block uids from stored templates to fix template editing#1119

Open
sid597 wants to merge 1 commit into
mainfrom
eng-1842-cannot-change-template-for-node
Open

ENG-1842 Strip block uids from stored templates to fix template editing#1119
sid597 wants to merge 1 commit into
mainfrom
eng-1842-cannot-change-template-for-node

Conversation

@sid597

@sid597 sid597 commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

@linear-code

linear-code Bot commented Jun 10, 2026

Copy link
Copy Markdown

ENG-1842

@vercel

vercel Bot commented Jun 10, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
discourse-graph Skipped Skipped Jun 10, 2026 7:40am

Request Review

@supabase

supabase Bot commented Jun 10, 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 1 additional finding.

Open in Devin Review

type RoamNode = {
text: string;
children?: RoamNode[];
uid?: string;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Why removing uid here fixes ENG-1842:

  • RoamNodeSchema is only used for DiscourseNodeSchema.template
  • The optional uid let migration store legacy template trees with their block uids in block props
  • ENG-1454: Base getter() task #828's Template panel seeds an ephemeral buffer from that stored template → create-block replays the old uids → Block already exists (the originals still live under legacy Template) → buffer never created → panel dead. Shipped in v0.19.0, hence "suddenly broken"
  • Nothing reads template uids from the store: panel save (serializeBlockTree) and createBlocksFromTemplate (stripTemplateUids) both strip them already
  • Zod drops unknown keys on parse, so removal fixes both directions:
    • read: already-poisoned graphs get clean templates immediately, no data migration
    • write: future migrations store uid-free
  • Alternative was stripping in EphemeralBlocksPanel, but that patches one consumer and leaves the next one to hit the same landmine
  • Legacy mode (flag off) reads the live block tree and never touches this schema; fresh graphs were never poisoned

@sid597 sid597 requested a review from mdroidian June 10, 2026 18:01
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.

2 participants