Repository navigation
Keep view counts consistent when a range insertion throws - #147
Closed
Mountaindonkey wants to merge 1 commit into
Closed
Mountaindonkey wants to merge 1 commit into
Mountaindonkey wants to merge 1 commit into
Conversation
Count matching entries locally while projecting a range, then apply the count after insertion and before notifying view subscribers. Exercise both a throwing selector on AddRange and a throwing filter on InsertRange.
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.
Fixes #144.
ObservableList<T>increments the synchronized view's count while projecting a range. When a later selector or filter call throws, earlier matches have been counted even though none of the new items have been inserted into the view.Count matches locally, then update the view's count after the range is inserted and before notifying subscribers. Exceptions still propagate to the caller. The source list has already accepted the range when it notifies the view.
Added regression tests for
AddRangewith a throwing selector andInsertRangewith a throwing filter. Both reproduced an off-by-one count onmaster.Tests
Prepared and tested with OpenAI Codex.