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

Adding new item to children example (App3) throws #4

Open
gaearon opened this issue Jan 4, 2015 · 2 comments
Open

Adding new item to children example (App3) throws #4

gaearon opened this issue Jan 4, 2015 · 2 comments

Comments

@gaearon
Copy link

gaearon commented Jan 4, 2015

I added "Add new" button to the third example with the following handler:

  handleAddClick: function () {
    var items = this.state.items,
        lastItem = items[items.length - 1] || '`'; // 'a' is next

    items.push(String.fromCharCode(lastItem.charCodeAt(0) + 1));
    items.sort();

    this.setState({
      items: items,
    });
  },

It throws with undefined config on this line.

I don't really understand Mori or lazy streams yet so I'd appreciate if you helped me figure out the issue.

@gaearon
Copy link
Author

gaearon commented Jan 4, 2015

It seems like configs are only computed once in getInitialStateStream so they don't take new children into account.

Edit: fixed in #5

@chenglou
Copy link
Owner

chenglou commented Jan 4, 2015

Yeah it's very manual right now. I'll abstract the whole logic away into a component/mixin soon.

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

Successfully merging a pull request may close this issue.

2 participants