Code Monkey home page Code Monkey logo

cooldux's People

Contributors

alysonz avatar monteslu avatar ninbryan avatar rhondarobot avatar warbrett avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

ninbryan

cooldux's Issues

makeDuck should also return a resetReducer

Instead of import { resetReducer } from cooldux :

export const { someAction, someOtherAction, initialStateCombined } = duck;

const reducer = resetReducer(initialStateCombined, (state = initialStateCombined, action) => {
  return duck.reducerCombined(state, action);
});

export default reducer;

It should be as simple as:

export const { someAction, someOtherAction } = duck;

export default duck.resetReducer;

you can still the former example if you need custom reducer functionality. Just finding myself using the same reset pattern too often

Promise Handler eating errors

More of a discussion than a bug but:
https://github.com/iceddev/cooldux/blob/master/index.js#L46

Here promiseHandler ends up gobbling up errors. Which means if I have a create method using it inside of a react component like so:

createMethod(someData)
  .then((success) => {
     this.setState({
       msg: 'thing successfully created'
     })
   })

It will always say thing was created. I'd prefer to explicitly handle the error myself by rethrowing it rather than just returning null, however I can see why some people might prefer the existing implementation.

How do you feel about throwing here vs returning the null?

need a cached action creator

We often make an action such as fetchIfNeeded() that checks the state first.

We could have the cooldux middleware do that if our actions were wrapped in a checkCache() type of function or potentially if cooldux options had a checkCache flag

Documentation Improvements

Documentation could probably be improved in the following areas:

  • combinedHandler needs to be explained.
  • Setting initialState with the various components, maybe an "initialState" section.
  • Examples Examples Examples
  • API documentation in a jsDoc fashion.

make action name optional for action creators

since we're never referencing it directly in a single duck, make it easier and increment a counter or something.

this can make it more difficult to debug if you're counting on action names, but yo: devtools, breakpoints, console.log etc.

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.