Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running into issues trying out the examples #13

Closed
healthycola opened this issue Dec 6, 2018 · 6 comments
Closed

Running into issues trying out the examples #13

healthycola opened this issue Dec 6, 2018 · 6 comments

Comments

@healthycola
Copy link

require("reselect/package.json"); // reselect is a peer dependency. 
var reselectMap = require("reselect-map")
var createArraySelector = reselectMap.createArraySelector;

const exampleState = {
  numbers: [1, 2.5, 3],
  multiplier: 5
};

const mul = createArraySelector(
  state => state.numbers,
  state => state.multiplier,
  (number, multiplier) => number * multiplier
);

const result = mul(exampleState);
console.log(result)

https://runkit.com/embed/lzksevx8x4ok

I ran the above, and continuously get an empty array. I also tried to do the same with createObjectSelector, but it was hitting some crashes. Any help on this would be great.

Thanks!

@heyimalex
Copy link
Owner

It looks like it broke with the reselect v4 release. Pretty sure it was reduxjs/reselect#297; reselect-map passes in a custom memoization function, but only expects it to be used for the final selector. I'll try to figure out a fix in the next couple of days.

@healthycola
Copy link
Author

Ah I see, I guess it's runkit's fault that it's not following your peer dependency assertion:
"reselect": "2.x || 3.x"

@healthycola
Copy link
Author

https://github.com/reduxjs/reselect#q-how-do-i-create-a-selector-that-takes-an-argument I think this can help in this case. Doing the memoization as part of the final step? What do you think?

@heyimalex
Copy link
Owner

Hey, thanks for the report! I've committed a fix and should publish the new version to npm tonight.

@healthycola
Copy link
Author

@heyimalex Thanks so much for the quick update! Can you publish if possible? :)

@heyimalex
Copy link
Owner

It should be up now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants