fix(extension-chrome): chain update/remove through createUlids within one batch#22
Merged
Conversation
… one batch When a user creates a bookmark and immediately renames it within the 500ms debounce window, both events land in the same flush batch. Previously: - The surviving filter saw idMap.ulidForNode(updateEvent.nodeId) == null (the id-map mutation is deferred until after the write succeeds) and dropped the update. - Even if the update had survived the filter, applyBatch's update branch would have continue'd for the same reason. - Result: the first GitHub commit had the ORIGINAL title; the rename was silently dropped until the user triggered another event. Pre-compute a set of nodeIds with create events in the same batch. The surviving filter accepts update/remove events for nodes either already mapped OR being created in this batch. applyBatch's update and remove branches consult createUlids when idMap returns null. TDD: failing test asserted final BookmarksFile carries 'Renamed' title; watched it fail RED (file had 'Original'). Implementation lifts; all 94 tests green (was 93). Closes #19
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.
Pre-existing race the second PR review surfaced (filed as #19). When create + rename land in the same 500ms debounce window the update was silently dropped.
Fix
Pre-compute a Set of nodeIds with create events in the current batch. The surviving filter accepts update/remove events for nodes either already in idMap OR being created in this batch. applyBatch consults createUlids when idMap returns null.
TDD
create + update on the same nodeId within one batch lands with the updated title (issue #19)— captured the produced file, asserted title was 'Renamed'; watched it fail (file had 'Original').Closes #19