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
Underscore _.where function return only one item #13049
Comments
This hit me too -- lots of places where I was using |
In this PR, things changed. Before, What you can do is override it like this: _.where = function(obj, attrs) {
return _.filter(obj, _.matches(attrs));
}; I'll test it here in your repo and leave an edit. edit: it works |
Yep, we're seeing this bug pop up in dependants of An array is expected here, but an object is returned from _.where(/* ... */)[0]
{ /* ... * /}[0] // <- undefined Yes, I know Here's the Thanks for all the hard work! |
Just in case anyone needs a short-term workaround - Meteor allows for override packages, even core, by placing the package source code in the
https://guide.meteor.com/writing-atmosphere-packages#local-packages |
@StorytellerCZ: Can you provide more context about this change? It replaced |
Hi,
I'm using and reproducing this with meteor on Mac (version 14.2.1) and ubuntu (version 20.04.6)
Since Meteor 2.15, with the upgrade of underscore from 1.0.13 to 1.6.1 .
The return of the function _.where(array, {criteriaToFind}) seems to always be the first element to correspond to the search.
In previous meteor versions, the function _.where used to return an array of every items find.
I made a repository to reproduce the problem.
https://github.com/LionelGuerin/meteor_underscore_where
It's composed of three folders to tests with meteor 2.15 , meteor 2.14 and with vanilla underscore NPM.
For meteor 2.15
Go to your browser then click on "Click Me"
You should see the following server log
For meteor 2.14
Go to your browser then click on "Click Me"
You should see the following server log
For vanilla underscore NPM
You should see the following log
I have seen another underscore issue with _.intersection, but it seems to be a different problem.
If you need any more information, i will be happy to help ;)
The text was updated successfully, but these errors were encountered: