Diffing RenderedElem trees to produce VDomPatch#3104
Conversation
Co-authored-by: sawka <2722291+sawka@users.noreply.github.com> Agent-Logs-Url: https://github.com/wavetermdev/waveterm/sessions/9937d178-e73d-4cdb-82b8-b1d0edfeaac6
Co-authored-by: sawka <2722291+sawka@users.noreply.github.com> Agent-Logs-Url: https://github.com/wavetermdev/waveterm/sessions/9937d178-e73d-4cdb-82b8-b1d0edfeaac6
Co-authored-by: sawka <2722291+sawka@users.noreply.github.com> Agent-Logs-Url: https://github.com/wavetermdev/waveterm/sessions/9937d178-e73d-4cdb-82b8-b1d0edfeaac6
| } | ||
| continue | ||
| } | ||
| insertions[oldPtr] = append(insertions[oldPtr], newIdx) |
There was a problem hiding this comment.
CRITICAL: Consecutive insertions after a matched element are incorrectly assigned to the same position.
The oldPtr is not incremented after processing an unmatched element (insertion). When there are multiple consecutive unmatched elements in the new array after a matched element, they all get assigned to the same insertion position.
Example: old=["a", "b"], new=["a", "x", "y", "b"]
- Expected: insert "x" at position 1, insert "y" at position 2
- Actual: both "x" and "y" inserted at position 1
Fix: Add oldPtr++ after line 330:
insertions[oldPtr] = append(insertions[oldPtr], newIdx)
oldPtr++
Code Review SummaryStatus: 1 Issue Found | Recommendation: Address before merge Overview
Issue Details (click to expand)CRITICAL
Files Reviewed (2 files)
The PR implements a virtual DOM diffing algorithm for Reviewed by minimax-m2.5-20260211 · 448,028 tokens |
Pull request created by AI Agent