Open mir3z opened 9 years ago
Not sure what's going on here. That's a query results different results as time goes by. Please ping me again when you have a confirmed case.
@wyuenho I seems have similar issue. My server response with total records, but then it get incremented on each model add
Demo of the problem https://jsfiddle.net/ogonkov/vugfj02n/
While server responded with 5 records in collection and results_count
(totalRecords
) of 10, final state is 3 pages, and 15 records.
This behaviour seems affects all versions since >=2.0.0 (haven't tested on 1.x)
There are so many things that could go wrong in your fiddle I can't figure out what's wrong. If you can simplify the fiddle to its bare essentials then I might be able to help.
@wyuenho i have simplified example: removed mock stringifying, and log all state changes to console instead of DOM. Please have a look https://jsfiddle.net/ogonkov/vugfj02n/21/
@ogonkov Hey, were you ever able to resolve this issue?
@hopkinschris not yet. I feel there should be some refactoring, to simplify thing that should happen during collection lifecycles. We need to know that totalRecords
was changed during last sync, and take it into account, when we handle models add. We need to react to state change, in more smart way.
I have a kind of road map for this in my head:
Consider following collection:
After fetching this collection, state object will be:
This is incorrect since there are 26 issues returned by following request: https://api.github.com/search/issues?q=repo:mozilla/BrowserQuest&sort=updated&per_page=9&page=1