brocoders / redux-async-connect

It allows you to request async data, store them in redux state and connect them to your react component.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

asyncItems.map is not a function

bartolkaruza opened this issue · comments

I'm running into an issue with the asyncConnect decorator on the 1.0.0-rc2 version. The exact same decorator was working without issue on 0.13. If I'm reading this commit correctly, we have to pass an array instead of an object now?

The error:

/Users/bartolkaruza/Development/Projects/dmm/dmm-web/node_modules/redux-async-connect/lib/asyncConnect.js:116
[1]   return asyncItems.map(function (item) {
[1]                     ^
[1] 
[1] TypeError: asyncItems.map is not a function
[1]     at wrapWithDispatch (/Users/bartolkaruza/Development/Projects/dmm/dmm-web/node_modules/redux-async-connect/lib/asyncConnect.js:116:21)

The decorator that causes the error;

@asyncConnect({
  segments: (params, helpers) => {
    return Promise.resolve();
  }
})
class Segments extends Component {

  render() {
    console.log(this.props.segments);
    return (
        <div>
          <h1>
            Segments
          </h1>
        </div>
    )
  }
}

Does it still work as static method in 1.0 or are decorators mandatory?
I'm getting Uncaught TypeError: asyncItems.reduce is not a function because asyncItems is a function if it's a static method

commented

So the example in the readme is outdated? I'm running into the same issue with rc4

https://github.com/xgqfrms-GitHub/rraio/issues/2

The .map function is only available on array.