Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Constructor overrites initial state? #6

Open
kzap opened this issue Nov 7, 2015 · 2 comments
Open

Constructor overrites initial state? #6

kzap opened this issue Nov 7, 2015 · 2 comments
Labels

Comments

@kzap
Copy link

kzap commented Nov 7, 2015

the constructor examples overwrites initial state by default
so what if your initial state comes from outside?
how do you insert that after the CONSTRUCTOR or
do we make the CONSTRUCTOR method decide how to merge passed data?

CONSTRUCT (domain) {
            return domain.concat(
              Immutable.fromJS([
                {
                    id: _.uniqueId(),
                    name: 'foo',
                    done: true
                },
                {
                    id: _.uniqueId(),
                    name: 'bar',
                    done: false
                },
                {
                    id: _.uniqueId(),
                    name: 'baz',
                    done: false
                },
                {
                    id: _.uniqueId(),
                    name: 'quux',
                    done: false
                }
            ])
          );
        },
@gajus gajus added the invalid label Feb 6, 2016
@gajus
Copy link
Owner

gajus commented Feb 6, 2016

Working on v2 of the spec. I am thinking of removing CONSTRUCT altogether in favour of providing a convenience function to build reducers and map actions. It will look something like this:

export default {
    analytics: combineReducers(_.mapValues(analytics, createReducer)),
    apiData: combineReducers(_.mapValues(apiData, createReducer)),
    calendar: createReducer(calendar),
    eventsUI: createReducer(eventsUI),
    locationForm: createReducer(locationForm),
    map: createReducer(map),
    trailer: createReducer(trailer)
};

@kzap
Copy link
Author

kzap commented Feb 21, 2016

that may work, as long as we keep it simple to think about

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants