You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While trying out all possible test cases with stores, I found that a filtered store that has defaultNewToStart set as true will notify (in Observable) new elements as to be placed at the END of the dataset. This is even though the caching store has placed the element at the start (as required) -- and ditto for the DB server.
The reason why it gets to this line is that since there is filtering, queryExecutor is defined and therefore it starts using it to work out where the element should be. At this point, only beforeId is used to place the element anywhere other than the end.
This means that stores without queries are basically treated the same as stores without any kind of queryEngine, since queryExecutor depends both on the presence of a queryEngine, and the presence of some kind of querying.
The text was updated successfully, but these errors were encountered:
About the ADDENDUM, at minimim this comment should be rewritten:
// we don't have a queryEngine, so we can't provide any information
// about where it was inserted or moved to. If it is an update, we leave
// its position alone. otherwise, we at least indicate a new object
Since this gets triggered not by the lack of queryEngine, but the lack of queryExecutor (that is, any kind of filtering/sorting/anything in the query).
However, I am looking at the code and wondering if this issue might point to some refactoring, both in the comments and the code itself.
While trying out all possible test cases with stores, I found that a filtered store that has
defaultNewToStart
set as true will notify (in Observable) new elements as to be placed at the END of the dataset. This is even though the caching store has placed the element at the start (as required) -- and ditto for the DB server.The problem is that in such a case the flow gets to line 290 of Observable: https://github.com/SitePen/dstore/blob/master/Observable.js#L290
The reason why it gets to this line is that since there is filtering,
queryExecutor
is defined and therefore it starts using it to work out where the element should be. At this point, onlybeforeId
is used to place the element anywhere other than the end.The solution is to change line 290 into:
However, I am not sure about something... see ADDENDUM.
ADDENDUM:
This rings a little strange to me) that if there is no filtering, the if in line 259 fails https://github.com/SitePen/dstore/blob/master/Observable.js#L259 :
This means that stores without queries are basically treated the same as stores without any kind of queryEngine, since queryExecutor depends both on the presence of a queryEngine, and the presence of some kind of querying.
The text was updated successfully, but these errors were encountered: