donejs-next place-my-order restaurant set comparator doesn't work as expected
See original GitHub issueIn the updated place-my-order guide the restaurant set comparators don’t appear to work as expected. They express a statement that will always return true - checking if the restaurantValue
is equal to property on the restaurant
object where restaurantValue
has been read from:
{
"address.city": function(restaurantValue, paramValue, restaurant){
return restaurant['address.city'] === restaurantValue;
},
"address.state": function(restaurantValue, paramValue, restaurant){
return restaurant['address.state'] === restaurantValue;
}
}
This ends up returning the complete set of restaurants when making a request that should be filtered by address.
The request is being made like: list.js
Restaurant.getList({
'address.state': state,
'address.city': city
});
and against the fixtures in the test like: list-test.js
restaurantStore.getList({"address.city": "Alberny"})
Both those end up returning the complete set of restaurants. When using different syntax:
Restaurant.getList({address: {state, city});
...
restaurantStore.getList({address: {city: "Alberny"}})
These requests end up returning the filtered list as expected during the test, without ever hitting either can-set comparator. Wondering why we were using the previous syntax at all.
Issue Analytics
- State:
- Created 6 years ago
- Comments:10 (3 by maintainers)
Top GitHub Comments
can-set 1.2.0 has the new set.prop.dotNotation so I’ll update the guide to include it’s use
Just going to paste here what we talked about, we want to make something like this work and then use it in the guide: