{"action":"closed","issue":{"url":"https://api.github.com/repos/algolia/instantsearch.js/issues/3267","repository_url":"https://api.github.com/repos/algolia/instantsearch.js","labels_url":"https://api.github.com/repos/algolia/instantsearch.js/issues/3267/labels{/name}","comments_url":"https://api.github.com/repos/algolia/instantsearch.js/issues/3267/comments","events_url":"https://api.github.com/repos/algolia/instantsearch.js/issues/3267/events","html_url":"https://github.com/algolia/instantsearch.js/issues/3267","id":381083718,"node_id":"MDU6SXNzdWUzODEwODM3MTg=","number":3267,"title":"Question: best practice when using infinite scrolling while the content is being modified","user":{"login":"tstehle","id":2255058,"node_id":"MDQ6VXNlcjIyNTUwNTg=","avatar_url":"https://avatars2.githubusercontent.com/u/2255058?v=4","gravatar_id":"","url":"https://api.github.com/users/tstehle","html_url":"https://github.com/tstehle","followers_url":"https://api.github.com/users/tstehle/followers","following_url":"https://api.github.com/users/tstehle/following{/other_user}","gists_url":"https://api.github.com/users/tstehle/gists{/gist_id}","starred_url":"https://api.github.com/users/tstehle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tstehle/subscriptions","organizations_url":"https://api.github.com/users/tstehle/orgs","repos_url":"https://api.github.com/users/tstehle/repos","events_url":"https://api.github.com/users/tstehle/events{/privacy}","received_events_url":"https://api.github.com/users/tstehle/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-11-15T09:59:07Z","updated_at":"2018-12-21T12:51:36Z","closed_at":"2018-12-21T12:51:36Z","author_association":"NONE","body":"I was wondering what the best practice was supposed to be when I use infinite scrolling, and the content changes server-side while a user is navigating, which leads to duplicates in the results displayed to the user.\r\n\r\nSuppose I store news articles in Algolia and a user asks for the first 10 results (index 0 to 9) ordered by creation date (newest first).\r\nAfter the user obtains the first 10 results, a different user creates a new article.\r\nSince the article is new, it is inserted at index 0 in the ordered list of articles.\r\nTherefore, the article that was previously at index 9 is now moved to index 10.\r\nWhen the first user asks for the next page of results, he will obtain 10 results, index 10 to 19.\r\nThe user will see a duplicate, as the result he got at index 9 is also visible at index 10.\r\n\r\nThis is problematic for infinite scrolling, as the duplicates are visually right next to each other.\r\n\r\nTo stop this from happening, I use lodash\r\n`const uniqueHits = _.uniqBy(hits, 'objectID');`\r\nin the function I pass to connectInfiniteHits.\r\n\r\nIs this best practice? Should this be handled transparently by the connector instead?"}}
{"actor":{"display_login":"Haroenv"}}