Code Monkey home page Code Monkey logo

Comments (9)

shankie-codes avatar shankie-codes commented on May 25, 2024 1

Yep that makes sense to leave the current as the default @mikestead

I'd be happy to help add this when we've got a new project that we're going to base on OpenAPI. Maybe @jedrichards and I could take a look at it? Anyways yes let's leave it open in the hopes that one of us has a project that makes it worthwhile.

from openapi-client.

shankie-codes avatar shankie-codes commented on May 25, 2024

(Disclaimer – I don't know TypeScript, but this looks like a pretty vanilla JS change anyways)

from openapi-client.

shankie-codes avatar shankie-codes commented on May 25, 2024

Oh and obvs I could do this in my reducer, but I think it's tidier to do all the main switching on actions.

from openapi-client.

shankie-codes avatar shankie-codes commented on May 25, 2024

Quick bump on this @mikestead – thoughts?

from openapi-client.

mikestead avatar mikestead commented on May 25, 2024

@shankiesan I can see the angle you're coming from but I'm not totally sure about this one.

As we always dispatch a FSA you can add middleware to inspect all actions for errors. From there you could siphon off more specific actions as required.

An aim here is to give some basic wiring but to also keep things light and not get too opinionated around how Redux has been setup. Not super easy, but was one of the reasons I went with FSA as it was well established.

from openapi-client.

shankie-codes avatar shankie-codes commented on May 25, 2024

Fair enough @mikestead . As you say, adding middleware to inspect all actions for errors is a good idea. I'll run with that. Cheers

from openapi-client.

jedrichards avatar jedrichards commented on May 25, 2024

The middleware/api actions in the official real world Redux example uses the _REQUEST, _SUCCESS and _FAILURE pattern. For my part I think this is more idiomatic Redux / best practice than the FSA format, which I haven't really seen get wide spread adoption in the wild.

https://github.com/reactjs/redux/blob/master/examples/real-world/src/actions/index.js

Just my 2 cents worth :)

from openapi-client.

shankie-codes avatar shankie-codes commented on May 25, 2024

Hey @mikestead I only just noticed @jedrichards comment. This is basically my feeling as well. I appreciate the FSA approach, but I think the idiomatic Redux approach would be more suitable.

How about a CLI flag for the action type? Obviously this is a major change, but something like --action-type=FSA or --action-type=redux would be pretty sweet.

from openapi-client.

mikestead avatar mikestead commented on May 25, 2024

@shankie-san @jedrichards Thanks for the feedback. Yeah a flag to opt into it sounds good. I'll reopen the ticket.

I'd probably want to keep the current default to be backwards compatible. Don't have time to look at this anytime soon I'm afraid.

from openapi-client.

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.