fix: regenerate block ids when pasting at root with no selection - #698
Merged
Conversation
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.
Contributor
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Reviews (2): Last reviewed commit: "fix: remove check for root block" | Re-trigger Greptile |
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
surajshetty3416
approved these changes
Jul 28, 2026
Contributor
|
Tick the box to add this pull request to the merge queue (same as
|
|
🎉 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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