Giter Club home page Giter Club logo

Comments (4)

mpp avatar mpp commented on August 29, 2024 1

Can't you dispatch that DeleteStakeholderAction at the end of the EffectMethod that handles CheckStakeholderAction?

If you need to distinguish if you're "CheckStakeholderAction" for deletion purpose, add a boolean property to the action so the effect knows if it needs to dispatch DeleteStakeholderAction or not.

This is the way Flux/Redux works. I suggest you to study that deeper and get more comfortable with the concepts.

from fluxor.

mpp avatar mpp commented on August 29, 2024

I'm not understanding your problem, add an example please.

from fluxor.

devantler avatar devantler commented on August 29, 2024

So for example in this code I am using the first Dispatcher to check if a Stakeholder exists, and it has an effect that sets the StakeholderExists to true. But that effect is executed asynchronously, which results in the StakeholderExists to retain its value false, and the DeleteStakeholderAction therefore never being fired.

Dispatcher.Dispatch(new CheckStakeholderAction(stakeholder));
if (StakeholderState.Value.StakeholderExists)
{
    Dispatcher.Dispatch(new DeleteStakeholderAction(stakeholder));
}

I can solve this by using a the bool IsLoading and a while loop like so:

Dispatcher.Dispatch(new CheckStakeholderAction(stakeholder));
while(StakeholderState.Value.IsLoading){
    //Do Nothing
}
if (StakeholderState.Value.StakeholderExists)
{
    Dispatcher.Dispatch(new DeleteStakeholderAction(stakeholder));
}

But It would be nice if I could instead await the HandleAsync method in my effect somehow.

from fluxor.

devantler avatar devantler commented on August 29, 2024

Okay thank you, I will look into Redux more, and try what you propose here. 👍

from fluxor.

Related Issues (20)

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.