Yomguithereal / baobab-react

React integration for Baobab.
MIT License
309 stars 38 forks source link

Cursor with array #88

Closed khankuan closed 8 years ago

khankuan commented 8 years ago

Hi, I noticed that the cursors in the examples are wrapped in an array. Is there a reason for that? Thanks!

Yomguithereal commented 8 years ago

Hello @khankuan. Can you precise which examples you are talking about please? I am not sure to know which ones you are mentionning.

khankuan commented 8 years ago

Something like this:

export default branch(List, {
  cursors: {
    colors: ['colors']
  }
});
Yomguithereal commented 8 years ago

You'd like to do this?

export default branch(List, {
  cursors: {
    colors: 'colors'
  }
});

If so, this is linked to #86. I need to make this happen.

khankuan commented 8 years ago

Ah yes :+1:

Yomguithereal commented 8 years ago

Well I just tested that and it seems you can already do it. I usually stick to the arrays because it's easier to change in the future if needed.

khankuan commented 8 years ago

I tried that and got .some is undefined :/

Yomguithereal commented 8 years ago

Can you give me the full error message please? Plus your version of Baobab/baobab-react.

khankuan commented 8 years ago
Uncaught TypeError: path.some is not a function

which points to

type.dynamicPath = function (path) {
  return path.some(function (step) {
    return type['function'](step) || type.object(step);
  });
};

On baobab 2.2.2 and baobab-react 1.0.0

Yomguithereal commented 8 years ago

Ok, found the bug. It's in Baobab. Fixing it.

Yomguithereal commented 8 years ago

Just published baobab v2.2.1. This should be good with this version.

khankuan commented 8 years ago

Nice!