fix: Error using moveBlocks in columns (BLO-1109)#2842
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis PR refactors block movement to defer column-list repairs until after insertion. The ChangesBlock Move Column-Fixing Refactor
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning Tools execution failed with the following error: Failed to run tools: 13 INTERNAL: Received RST_STREAM with code 2 (Internal server error) Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Summary
This PR fixes an edge case when using
moveBlockswith columns.moveBlocksfirst removes the target block(s), then inserts it/them above/below the previous/next block. In the removal step,fixColumnsis called for all affected column lists, collapsing them or individual columns when they're empty.This causes an error in the following case:
When moving the non-empty paragraph block up, it's first removed. This leaves the column with a single empty paragraph, which
fixColumnsreads as an empty column, and so collapses it. Upon re-insertion, the reference block no longer exists and an error is thrown. This also happens when the order of the 2 blocks is flipped and the non-empty one is moved down.The fix for this is to defer calling
fixColumnsafter the re-insertion. So afixColumnsoption has been added toremoveAndInsertBlocksso that thefixColumnsfunction can be suppressed when removing blocks.Closes #2594
Rationale
This is a bug.
Changes
See above.
Impact
N/A
Testing
Added unit tests.
Screenshots/Video
N/A
Checklist
Additional Notes
N/A
Summary by CodeRabbit
Bug Fixes
Tests