-
Notifications
You must be signed in to change notification settings - Fork 16
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
Support SkipRepeats #5
Comments
Hi Ran, As far as I can tell, If I understand you correctly, your request is in fact about being able to subscribe to substate instead of the entire state, is that correct? |
Hi @svdo actually I also noticed that so yes. If this library will support selectors (subscribe to part of the state like: sub state or even property of the state) it will be amazing! Thanks, |
Hi @svdo what do you think about adding support to selectors? (picking sub state instead of the full app state)? |
I like the idea, but I don't have time to work on it atm I'm afraid... |
Hi,
I wanted to know if this library support or maybe can support SkipRepeats.
What is SkipRepeats + Example:
SkipRepeats allows ReSwift framework to skip and not trigger the newState delegate method in case the sub-state was not changed. It's really simple but very helpful feature that can boost apps performance.
Let's assume that I have the following AppState in my app:
In order to use skip repeats you need to divide your AppState to sub-states and subscribe to the sub state (or part of it) in the view controller. Each sub-state must conform to Equatable, this way the framework can detect if the sub-state has been changed or not (after dispatching an action) and only if it was changed then the newState method will be called.
So current user state looks like the following:
Now, because ReSwift implemented selectors you can subscribe only to part of your state inside your view controller:
As you can see from the code above, If I put skipRepeats() the view controller newState (the subscriber) will be called only if the currentUserState changed.
SkipRepeats is a small but very powerful feature that can lead to big improvements in the performance of an app and especially for a big apps.
I wanted to know if it is possible to support skipRepeats in this library as well or maybe it is already supported and I am missing something?
Thanks in advance!
The text was updated successfully, but these errors were encountered: