Git Product home page Git Product logo

redux-decorators's People

Contributors

blai avatar karlpurk avatar kayue avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

redux-decorators's Issues

Are all Reducer registered globally?

May I know is Action / Reducer are always registered globally?

In the Plnkr example, app/action-reducers.ts registered some actions. If I have a large application, looks like I have to be careful with naming my action name, make sure there is no duplication.

Add Payload to reducer

As it is right now the only way to use the action is by

class MyReducers {
    @Reducer() add(state): { return { count: state.count + 1; } }
}

An idea that i have on how to make this better is doing something like:

class MyReducers {
    @Reducer() add(state, action): { console.log(action.payload) }
}

What do you think?

Investigate using RxJS observables with store-connected properties

Currently @Store and @State just push new changes into a property on the target class.

We should investigate how an implementation using RxJS observables could work.

Would it require a new decorator or can we extend an existing one?

Are these mutually exclusive or should we allow users to mix observables with normal properties?

State is missing from type definitions

I'm unable to add @State() todos:Todo[] = []; to the @Store as State is not available on index.d.ts.

The PR below adds this to index.d.ts to make State available in TS.
export function State(...name: string[]): Function;

See PR #12

Using multiple stores?

Hi,

I'm really liking the idea of these decorators. But I'm curious it it would be possible to use multiple stores? I.e. in a larger app, one to hold the state for say the breadcrumbs, and another to hold the state of the page itself. How could I go about achieving this?

Thanks

Inital Redux action type is never being caught and initializing state

Inital Redux action type is never being caught and initializing state. I noticed inital action type from Redux was always coming in @@INIT instead of @@redux/INIT. I changed the check to test for the regex expression instead /@@.*init/ig which fixed the issue. This catches either @@redux/INIT or @@INIT.

See PR #12

Improvements to action reducers.

I think action reducers should be passed the value that they operate on, rather than the full state tree. So instead of:

class MyReducers {
    add(state): { return { count: state.count + 1; } 
}

Instead we should be able to write something like this:

class MyReducers {
    add(count = 0): { return count + 1; }
}

The question is how do we achieve this with decorators? Do we assume that a class of action reducers all work on the same state slice, like this:

@Reducer({slice: 'count', actions: ['add', 'remove']})
class MyReducers {
    add(count = 0): { return count + 1; }
}

Or do we implement this on a per-method basis, like this:

class MyReducers {
    @Reducer('count') add(count = 0): { return count + 1; }
}

Thoughts?

Subscribe Support?

Is there a was to subscribe to appState's state changes? The simple bindings for component properties is phenomenal, but my components and services need to run custom code on state change.
My proposed enhancement is for @Store to detect which stateProperties are functions and have them subscribe to appStore.

I wanted to check that there wasn't an easier existing method to subscribe to @Store and that the above proposed implementation was acceptable before I started working on an enhancement in my fork.

Thanks!

Action Reducer enhancement

Now:

class MyReducers {
    @Reducer('add') add(state): { return { count: state.count + 1; } }
}

Enhanced:

class MyReducers {
    @Reducer() add(state): { return { count: state.count + 1; } }
}

Is this possible?

Module not found: Error: Can't resolve 'redux-decorators'

It did not work when using it in combination with webpack. I had to go to the package.json and change the following:

"main": "src/redux-decorators.js" to "main": "dist/redux-decorators.js"

After this Webpack was able to resolve the module no problem.

Move from TSD to Typings

TSD to Typings which is recommended now by the TSD author.

DEPRECATED: TSD is deprecated, please use Typings and see this issue for more information.

See PR #12 for change

Should `@Reducers` be decomposed into separate decorators?

The more I look at the dual purpose of the @Reducer decorator the more I dislike it.

It doesn't make sense to have one decorator serve 2 purposes.

There are a few options here.

  1. Introduce a new @RootReducer decorator and move the root reducer functionality to this new decorator.
  2. Introduce a new @Action decorator and move the action reducer functionality to this new decorator.

Perhaps a combination of the two?

Thoughts welcome.

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.