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

Wrong behaviour resetting collection without models array #38

Open
mogarick opened this issue Apr 21, 2015 · 0 comments
Open

Wrong behaviour resetting collection without models array #38

mogarick opened this issue Apr 21, 2015 · 0 comments

Comments

@mogarick
Copy link

Calling collection.reset() without arguments causes a wrong behaviour due to line 588 of query-engine.js. (QueryCollection.prototype.add). It looks the problem is the condition that forces the creation of an array when models argument is not one (:[models]). It creates an array even in the case the models argument of add method is undefined. This causes the array to have 1 phantom element ({}).
Fortunately there is an easy workaround, to call reset method with an an empty array (collection.reset([])). This way the condition that gets evaluated is ?models.slice() and that returns an empty array which is the expected behaviour.

Are you accepting pull requests? I see many issues open.

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

No branches or pull requests

2 participants