Skip to content

fix(Lists): improve nested list collapse for deep structures#1041

Merged
makhnatkin merged 3 commits intomainfrom
fix/collapse-lists
Apr 1, 2026
Merged

fix(Lists): improve nested list collapse for deep structures#1041
makhnatkin merged 3 commits intomainfrom
fix/collapse-lists

Conversation

@makhnatkin
Copy link
Copy Markdown
Collaborator

@makhnatkin makhnatkin commented Apr 1, 2026

Fixes #1042

Improvements

  • O(N) single-pass algorithm: replaced iterative O(K*N) approach with a single tree traversal that collects all redundant nesting in one pass
  • Recursive flattening: handles deeply nested structures (up to 100 levels) with proper depth guards
  • Correct position mapping: applies replacements in reverse order to preserve document positions, uses tr.mapping for accurate cursor placement

@makhnatkin makhnatkin requested a review from d3m1d0v as a code owner April 1, 2026 09:01
@gravity-ui
Copy link
Copy Markdown

gravity-ui bot commented Apr 1, 2026

Storybook Deployed

@gravity-ui
Copy link
Copy Markdown

gravity-ui bot commented Apr 1, 2026

🎭 Playwright Report

@makhnatkin makhnatkin merged commit 6dca6ae into main Apr 1, 2026
7 of 9 checks passed
@makhnatkin makhnatkin deleted the fix/collapse-lists branch April 1, 2026 15:37
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.

Crash when switching from Markdown to WYSIWYG with numbered items inside bullet list

2 participants