-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
feat: allow user to choose which event or state change to be captured in the changeStack or not #4178
Comments
Hi @whowillcare 👋 Are you able to provide a bit more context around your use-case? |
The simplest user case would be like:
State:
list: ['a','b','c']
currentIndex: 0
Event:
add: 'd' # add an element to list
remove: 'a' # remove 'a' from list
Event:
select: 1 # select to new index change the currentIndex to 1
So I would like the Undo or Redo events don't need to catch the select
event, but still catch the add or remove event, which gives more
flexibility by making certain changes are Replay-able, certains are not.
…On Tue, Jun 4, 2024 at 1:08 AM Felix Angelov ***@***.***> wrote:
Hi @whowillcare <https://github.com/whowillcare> 👋
Thanks for opening an issue!
Are you able to provide a bit more context around your use-case?
ReplayBloc has a shouldReplay
<https://pub.dev/documentation/replay_bloc/latest/replay_bloc/ReplayBlocMixin/shouldReplay.html>
API which seems like it might be what you're looking for.
—
Reply to this email directly, view it on GitHub
<#4178 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABUL3KF6XUGOSIEG4VRIIJLZFVDTJAVCNFSM6AAAAABIFVWRUWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNBWGYZDCNBRGY>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I have the same requirement. For example, if a certain state is triggered by the PageEventStarted event (an event added when the page is started), this event should not be added to the changeStack. Is it possible to determine shouldReplay based on the event itself, rather than just the state? |
This should be possible to do already using
Generally, I don't recommend this because the thing that is being replayed is the state not the event so ideally all information that you need to determine whether a state should be replay-able should be encoded in the state itself. Furthermore, there's a Closing this for now since this issue is quite old but if this is still an issue for folks I highly recommend filing a new issue with as much context as possible and ideally a minimal reproduction sample, thanks! 🙏 |
Description
The current solution doesn't have a feature that allow user to specify which events to be added to the changeStack, and which ones are not, which will give user flexiblity to redo or undo specific states changes
Desired Solution
Alternatives Considered
or keep the super.emit to an alternative method name, so the child class can always override the emit method for implementing the similar feature
Additional Context
which will save the resource and allow user to have more flexiblities
The text was updated successfully, but these errors were encountered: