Repository navigation
fix(replay_bloc): respect a lowered limit - #4902
Open
ChandraChaan wants to merge 2 commits into
Open
ChandraChaan wants to merge 2 commits into
ChandraChaan wants to merge 2 commits into
Conversation
uveshm003
reviewed
Oct 29, 2026
There was a problem hiding this comment.
redo() adds back to _history without trimming, so redoing after lowering the limit goes past it:
cubit
..increment()..increment()..increment()
..undo()..undo()
..limit = 1
..redo()..redo()
..undo()..undo()..undo(); // 3 undos with limit 1 -> states end [..., 2, 1, 0]Calling _trimHistory() at the end of redo() fixes it.
Author
|
Good catch @uveshm003, thanks! Reproduced it: with your sequence the states ended Fixed in b67c143: |
This branch has not been deployed
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.
Status
READY
Breaking Changes
NO
Description
limitcan be changed after construction through the publiclimitsetter, but_ChangeStackonly enforced it partly:limitdidn't trim the existing history, soundo()could still go back past the new limit.addremoved at most one entry per change (ifinstead ofwhile), so after lowering the limit the history never shrank to it._ChangeStack.limitis now a setter that trims the history right away, andadduses the same trimming, which removes entries until the history fits. Behaviour for an unchanged limit is the same as before:nullor a negative limit keeps unlimited history, and0records nothing.Added two tests: undo after lowering the limit, and the next change after lowering the limit.
Fixes #4901
Type of Change