canjs / can-query-logic

Perform data queries and compare queries against each other. Provides logic useful for data caching and real-time behavior.

Home Page:https://canjs.com/doc/can-query-logic.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

adding first item to the list returning an undefined index

pYr0x opened this issue · comments

hey guys

i found a bug in can-query-logic with realtimeRestModel.
if a have an empty list and i will add the first item to it, by saving it, i hit this line:
https://github.com/canjs/can-query-logic/blob/master/src/helpers.js#L105
but with an empty list the first index should be 0 and not undefined. so i wondering why you checked for !items.length because items.length with 0 is true.

Example:
https://codepen.io/pYr0x/pen/mdwOQyo