Comments (4)
It's hard to tell what problem you are facing. The library shouldn't restrict that so it's probably something else that causes the behaviour you see.
I can recommend checking the sample app that does that already and also reading this page of the docs: Implementing your view actions flow
from mvflow.
The reason our code unable to have same emissions due to the state is not changing when we clicks that buttonA
.
Is it possible to have same data class State
value even though it's not changing?
the reason we're manually resetting the state was to mutate the
data class State
so it's able to click again inbuttonA
Will look for more samples on your code, I've found so far at the counter samples, the data class State
is always has a new value.
from mvflow.
Is it possible to have same data class State value even though it's not changing?
If I understand what you are saying correctly, this is breaking one of the core principles of MVI (not just of this library). If the state doesn't change, there is no reason to update the UI so we shouldn't emit a new state. The state needs to represent everything in the screen and there can be no difference in terms of UI if you render the same state (regardless of previous states, for example).
If something in the UI needs to change, you need to make that part of the state; otherwise if you just want to make something like showing a Toast or launching another screen, you can use effects.
To be clear, your handler will still receive the actions (initially I understood that the handler wasn't receiving them). So then the handler can either emit a mutation that indeed changes the state from the previous value or it can emit an effect.
from mvflow.
Ah, I see, so for our particular cases, the effect
seems fit for multiple same event, e.g: showing a toast/dialog (user able to click it multiple times, even though there's no need to mutate a state) without the needs to reset our state manually or changing that particular state
from mvflow.
Related Issues (11)
- Is it possible to add time travel debugger? HOT 4
- Unit Test samples HOT 1
- Handler State Become Stale for Actions That Produce Long Running Flows HOT 1
- is it possible to use MVFlow in Jetpack Compose? HOT 1
- Consider moving from SharedFlow to Channel HOT 1
- Best practices to send a throwable from Fragment/Activity? HOT 2
- Is it possible to combine reducer & handler? HOT 1
- Migrate from jcenter HOT 1
- How to stop an async task launched by the handler HOT 2
- Android sample app wont even sync on latest Android Studio Iguana HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mvflow.