redux-async-connect icon indicating copy to clipboard operation
redux-async-connect copied to clipboard

asyncItems.map is not a function

Open bartolkaruza opened this issue 9 years ago • 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>
    )
  }
}

bartolkaruza avatar Feb 24 '16 14:02 bartolkaruza

@bartolkaruza, Hey,

please see example here: https://github.com/erikras/react-redux-universal-hot-example/pull/928/files

sars avatar Feb 24 '16 21:02 sars

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

Keats avatar Mar 01 '16 16:03 Keats

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

marpe avatar Nov 10 '16 17:11 marpe

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

The .map function is only available on array.

xgqfrms-GitHub avatar Jul 18 '17 16:07 xgqfrms-GitHub