Fix: Patch application race conditions and large list handling#1
Merged
xentixar merged 2 commits intoDec 6, 2025
Merged
Conversation
…ndling - Add request cancellation and sequencing to prevent stale patches - Fix patch application order (removes first, then creates/updates) - Improve error handling in PatchApplier with better warnings - Enhance diff engine to handle empty lists and keyed children better - Sort remove patches in reverse order to prevent index shifting - Add fallback handling for failed patch applications Fixes issue where old data remains visible after search in large lists (100+ items). Ensures patches are applied in correct order even with rapid updates.
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.
Problem
When using Diffyne with large lists (100+ items) and search functionality, patches were not applying correctly sometimes. Old data would remain visible after search, especially when:
Solution
This PR fixes patch application issues by:
Request Cancellation & Sequencing
Improved Patch Application Order
Better Error Handling
Diff Engine Improvements
Testing
Tested with:
Files Changed
resources/js/Diffyne.js- Request cancellation and sequencingresources/js/core/PatchApplier.js- Improved patch application ordersrc/VirtualDOM/DiffEngine.php- Better diff handling for empty listspublic/js/diffyne.js- Built JavaScriptBreaking Changes
None - this is a bug fix that maintains backward compatibility.