Giter Site home page Giter Site logo

Comments (4)

pedroql avatar pedroql commented on May 27, 2024

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.

mochadwi avatar mochadwi commented on May 27, 2024

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 in buttonA

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.

pedroql avatar pedroql commented on May 27, 2024

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.

mochadwi avatar mochadwi commented on May 27, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.