Code Monkey home page Code Monkey logo

Comments (3)

KevinAst avatar KevinAst commented on June 27, 2024

Hello Ivo,

Jeff may have additional insight here, but you can optionally pass an action parameter to your reject() invocation.

There are different conditions, where the action can be:

  1. the original action
  2. one with a modified payload
  3. a completely new action (i.e. different action type)
  4. or no action parameter at all

I believe the third case will service your needs. If you call reject(newAction) redux-logic will basically kill the current action and re-dispatch the new one.

from redux-logic.

hyperivo avatar hyperivo commented on June 27, 2024

Hi @KevinAst,

Indeed 3. would solve my use case.

Thanks for your help :)

--Ivo

from redux-logic.

jeffbski avatar jeffbski commented on June 27, 2024

Thanks for the question @hyperivo!

Kevin did a good job summarizing that. I appreciate it @KevinAst .

So yes, when you pass an action to accept or reject it will look at the type. If it is the same type it will internally call the middleware next handing it down to the rest of the middlewares and reducer. If it was a different type it will instead dispatch so that all necessary middleware will have a chance to see it. This behavior can be overridden with options but normally it is exactly what you want to happen (it also prevents the potential loops).

from redux-logic.

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.