I had a question where I thought I needed some expert advice.
I have an infinitely scrollable div
which is loaded by a list, 10 at a time. Everything works fine if there are no changes in the list.
I have a form which prepends the list with a new item and hence disturbs the sequence of infinite scroll i.e. last item in the displayed content is repeated.
I'd be thankful if anyone could advice me how to handle this condition. Things I tried to do,
- Splicing the last item in the already displayed content. (vague way, will not be useful if list is prepended with multiple items)
- Keeping track of how many items are prepended and passing a
skip = <number_of_prepended_items>
argument to the server to skip these newly added items (works fine but i feel it will break) - Reload the first 10 items upon addition of new item.
Any suggestions?