Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ChangeStackSignal behavior #265

Closed
rodrigopequeno opened this issue May 9, 2024 · 2 comments
Closed

ChangeStackSignal behavior #265

rodrigopequeno opened this issue May 9, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@rodrigopequeno
Copy link

I'm using ChangeStackSignal and I noticed when updating to the latest version (5.2.0/5.2.1) a different behavior than version 4.5.1.

Using the example in the documentation as a basis: Link

final s = ChangeStackSignal(0, limit: 2);
s.value = 1;
s.value = 2;
s.value = 3;
print(s.value); // 3
s.undo();
s.undo();
print(s.value); // 1
print(s.canUndo); // false
s.redo();
print(s.value); // 2

The test below fails on expect(s.value, 1) as the current value is 3:

void main() {
  test(
    'should do undo N times',
    () {
      final s = changeStack(0, limit: 2);
      s.value = 1;
      s.value = 2;
      s.value = 3;
      expect(s.value, 3); // 3
      s.undo();
      s.undo();
      expect(s.value, 1); // 1
      expect(s.canUndo, false); // false
      s.redo();
      expect(s.value, 2); // 2
    },
  );
}
@rodydavis rodydavis added the bug Something isn't working label May 9, 2024
@rodydavis
Copy link
Owner

Thanks for reporting, will try to reproduce!

@rodydavis
Copy link
Owner

Fixed and will be on the next release!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants