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

Failure with createStore() #20

Closed
jareware opened this issue Aug 10, 2015 · 6 comments
Closed

Failure with createStore() #20

jareware opened this issue Aug 10, 2015 · 6 comments

Comments

@jareware
Copy link
Contributor

If I define a store like:

import immutable from 'alt/utils/ImmutableUtil';

alt.createStore(immutable({
  displayName: 'derpStore',
  state: new Immutable.Map({
    count: 0
  }),
  reduce: (state, payload) => {
    return state.updateIn([ 'count' ], x => x + 1);
  }
}));

I get:

TypeError: Cannot read property 'onSerialize' of undefined

from here.

If I use alt.addStore(StoreClass) with the same config patched into the prototype it works as expected. Also the immutable-util works as expected, because when I takeSnapshot('derpStore') I get a sensible serialization.

Ideas?

@jareware
Copy link
Contributor Author

Well, actually it looks like this config access should actually use store.StoreModel.config like snapshot() does, and it sorta accidentally works with class-based stores because the config is available on the prototype chain.

jareware added a commit to jareware/alt-devtool that referenced this issue Aug 11, 2015
@jbroadice
Copy link

This is also happening when using alt-router.

@goatslacker
Copy link
Owner

Fixed in alt@0.17.8.

@goatslacker
Copy link
Owner

goatslacker/alt@d72eb9d

@jareware
Copy link
Contributor Author

Very nice, thanks!

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

No branches or pull requests

4 participants
@goatslacker @jareware @jbroadice and others