Skip to content

fix: regenerate block ids when pasting at root with no selection - #698

Merged
stravo1 merged 2 commits into
frappe:developfrom
stravo1:fix-block-copy
Jul 28, 2026
Merged

fix: regenerate block ids when pasting at root with no selection#698
stravo1 merged 2 commits into
frappe:developfrom
stravo1:fix-block-copy

Conversation

@stravo1

@stravo1 stravo1 commented Jul 28, 2026

Copy link
Copy Markdown
Member

Pasting with nothing selected routed clipboard blocks through canvasStore.pushBlocks -> Block.addChild, which retains the original blockId (and every nested child's id) instead of generating fresh ones. Selection and click resolution are keyed by blockId with a first-match tree search, so selecting the newly pasted block resolved back to the original. Strip and regenerate ids via getBlockCopy in this path, matching the paste-into-selected-block path, except when pasting a full page root (blockId "root"), which replaces the existing root wholesale and can't collide.

Before:

Screen.Recording.2026-07-28.at.12.36.38.PM.mov

After:

Screen.Recording.2026-07-28.at.12.37.55.PM.mov

Pasting with nothing selected routed clipboard blocks through
canvasStore.pushBlocks -> Block.addChild, which retains the original
blockId (and every nested child's id) instead of generating fresh
ones. Selection and click resolution are keyed by blockId with a
first-match tree search, so selecting the newly pasted block resolved
back to the original. Strip and regenerate ids via getBlockCopy in
this path, matching the paste-into-selected-block path, except when
pasting a full page root (blockId "root"), which replaces the
existing root wholesale and can't collide.
@greptile-apps

greptile-apps Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Reviews (2): Last reviewed commit: "fix: remove check for root block" | Re-trigger Greptile

@stravo1
stravo1 requested a review from surajshetty3416 July 28, 2026 07:13
@codecov

codecov Bot commented Jul 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 57.59%. Comparing base (f737b23) to head (d9434c0).
⚠️ Report is 3 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop     #698   +/-   ##
========================================
  Coverage    57.59%   57.59%           
========================================
  Files           35       35           
  Lines         4271     4271           
========================================
  Hits          2460     2460           
  Misses        1811     1811           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mergify

mergify Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@stravo1
stravo1 merged commit 1cd39a0 into frappe:develop Jul 28, 2026
7 of 8 checks passed
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.32.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

surajshetty3416 pushed a commit that referenced this pull request Aug 2, 2026
fix: regenerate block ids when pasting at root with no selection
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants