Yomguithereal/baobab-react

Cursor with array

khankuan opened this issue · 11 comments

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

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

Something like this:

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

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.

Ah yes 👍

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.

I tried that and got .some is undefined :/

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

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

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

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

Nice!