Cache not written to storage after removal of selectors from the last slot #3
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.
On removal of a selector from the last slot, the entire operation happens in the cache (named
slot.selectorSlot
). There is a flag to mark it 'dirty', calledslot.newSlot
, which is used correctly when adding new selectors. However it is not changed upon removal, and if you only remove a slot, the cache is not written back. This causes the storage to still contain the removed selector.Final slot before removal:
Final slot after removal of sel3, cache:
Final slot in storage after removal:
By setting the dirty flag to true, the cache is written back correctly.
The PR adds a test checking if the bug exists.