brocoders/redux-async-connect

asyncItems.map is not a function

bartolkaruza opened this issue ยท 4 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>
    )
  }
}
Keats commented

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

marpe 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.