{"action":"created","issue":{"url":"https://api.github.com/repos/backbone-paginator/backbone.paginator/issues/315","repository_url":"https://api.github.com/repos/backbone-paginator/backbone.paginator","labels_url":"https://api.github.com/repos/backbone-paginator/backbone.paginator/issues/315/labels{/name}","comments_url":"https://api.github.com/repos/backbone-paginator/backbone.paginator/issues/315/comments","events_url":"https://api.github.com/repos/backbone-paginator/backbone.paginator/issues/315/events","html_url":"https://github.com/backbone-paginator/backbone.paginator/issues/315","id":139000439,"number":315,"title":"Infinite mode getNextPage resets the collection","user":{"login":"ristovskiv","id":8341607,"avatar_url":"https://avatars.githubusercontent.com/u/8341607?v=3","gravatar_id":"","url":"https://api.github.com/users/ristovskiv","html_url":"https://github.com/ristovskiv","followers_url":"https://api.github.com/users/ristovskiv/followers","following_url":"https://api.github.com/users/ristovskiv/following{/other_user}","gists_url":"https://api.github.com/users/ristovskiv/gists{/gist_id}","starred_url":"https://api.github.com/users/ristovskiv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ristovskiv/subscriptions","organizations_url":"https://api.github.com/users/ristovskiv/orgs","repos_url":"https://api.github.com/users/ristovskiv/repos","events_url":"https://api.github.com/users/ristovskiv/events{/privacy}","received_events_url":"https://api.github.com/users/ristovskiv/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-03-07T15:01:03Z","updated_at":"2016-09-22T16:02:53Z","closed_at":null,"body":"In infinite mode on  `collection.getNextPage` instead of models being add to the collection, the collection resets with the models from the current page.\r\n\r\nHere is my collection code.\r\n\r\n```\r\nclass LoopCampaigns.Collections.MailTemplates extends Backbone.PageableCollection\r\n\r\n  url: \"/api/mail_templates\"\r\n\r\n  mode: 'infinite'\r\n\r\n  state:\r\n   pageSize: 10\r\n\r\n  model: LoopCampaigns.Models.MailTemplate\r\n\r\n  parseRecords: (response)->\r\n    return response['mail_templates']\r\n\r\n  parseLinks: (response)->\r\n    return {next: response.links.next, first: response.links.first, prev: response.links.prev, total_entries: response.links.total_entries}\r\n```\r\n\r\nhere is a preview from the json response from my Rails API\r\n\r\n```\r\n{\r\n\"mail_templates\": [\r\n{...},\r\n{...},\r\n{...},\r\n{...},\r\n{...},\r\n{...},\r\n{...},\r\n{...},\r\n{...},\r\n{...}\r\n],\r\n\"links\": {\r\n\"first\": \"/api/mail_templates?page=1\",\r\n\"next\": \"/api/mail_templates?page=2\",\r\n\"prev\": \"/api/mail_templates?page=0\",\r\n\"total_entries\": 16\r\n}\r\n}\r\n```\r\n\r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/backbone-paginator/backbone.paginator/issues/comments/248947965","html_url":"https://github.com/backbone-paginator/backbone.paginator/issues/315#issuecomment-248947965","issue_url":"https://api.github.com/repos/backbone-paginator/backbone.paginator/issues/315","id":248947965,"user":{"login":"emileber","id":3286135,"avatar_url":"https://avatars.githubusercontent.com/u/3286135?v=3","gravatar_id":"","url":"https://api.github.com/users/emileber","html_url":"https://github.com/emileber","followers_url":"https://api.github.com/users/emileber/followers","following_url":"https://api.github.com/users/emileber/following{/other_user}","gists_url":"https://api.github.com/users/emileber/gists{/gist_id}","starred_url":"https://api.github.com/users/emileber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emileber/subscriptions","organizations_url":"https://api.github.com/users/emileber/orgs","repos_url":"https://api.github.com/users/emileber/repos","events_url":"https://api.github.com/users/emileber/events{/privacy}","received_events_url":"https://api.github.com/users/emileber/received_events","type":"User","site_admin":false},"created_at":"2016-09-22T16:02:53Z","updated_at":"2016-09-22T16:02:53Z","body":"In infinite mode, there's a `fullCollection` inside your collection which serves as a container for the already fetched models, but only the current page is in the collection models array.\r\n\r\nIf you're after infinite scroll or something akin to this, without a need for paging, I made an [infinite collection](https://gist.github.com/emileber/7c3b472fa45d8a208d9a8317bb2f38ae) inspired by the API of this lib."}}
{"actor":{"display_login":"emileber"}}