I have a outlining app that I am writing using unidirectional dataflow and some of the concepts from Redux.

When the user has selects items in the outline, and clicks indent, an indent action is fired. This needs to update the state of the app via some complex rules that modify the parent property of some, if not all, of the items being indented.

These changes also need to persist out to a web service.

I do not want to repeat this logic in multiple places.

The question is, should I be applying this logic inside of the middleware, and just passing along simpler actions to the reducer? Or should I be somehow analyzing the state after the reducer has applied the logic and then sending the changes to the web service?

  • Is this a web app, mobile app or desktop application? An embedded system? Jul 4, 2022 at 2:04
  • 1
    And what do you mean by "middleware"? Jul 4, 2022 at 2:04
  • This is a web app (specifically a PWA). If you are familiar with Redux, middleware is code that lies between an action an a reducer.
    – bnieland
    Jul 5, 2022 at 14:12


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.