[Solved] Endless scroll bug?

  • Even though I correctly run done() it keeps on loading endlessly!

    	loadMore(index, done) {
    		// index - called for nth time
    		// done - Function to call when you made all necessary updates.
    		//        DO NOT forget to call it otherwise your loading message
    		//        will continue to be displayed
    		// make some Ajax call then call done()
    		store.dispatch('fetchDone').then(fetched => {
    			if (fetched == 'fetchedAll'){

    Also, I wonder what the difference between done() and stop() is. The docs are unclear in that.

  • Try done(true). This schould stop endless loading

  • I got this from chatting on Gitter, in case anyone wants to know:

    The stop() method is used to interrupt loading no matter the scroll position. The done() method should always be called after each ajax request, else the loading message stays
    → on all callbacks?
    Yes. It used to define not your fetch is done but to define your REQUEST is done. Always call done() at the end of the handler.
    So in your case:

    store.dispatch('fetchDone').then(_ => done());

    → I don’t need to indicate there’s no more data on the server left to fetch?

    just save something like true to window.noMoreData if all data is fetched. And if (window.noMoreData){ return } in front of the ajax call in the loadMore method.

Log in to reply