Bug #2946

Async paginators called simultaneously

Added by Anatoly Shcherbinin almost 4 years ago. Updated over 3 years ago.

Status:FixedStart date:03/11/2015
Priority:NormalDue date:
Assignee:Andreas Smas% Done:

0%

Category:Ecmascript & Duktape
Target version:5.2
Found in version:4.10.36.g339aa Platform:OS X

Description

If navigate in menu, when async paginator performing on page launch, then another paginator will be started.
This cause duplicates in media list, because simultaneous paginator performed on old offset.

Test code:

var cnt = 30;
function items(page, o, new_offset){
    print("offset "+ o);
    setTimeout(function(){

        for(var i = 0; i < cnt; i++) {
            page.appendItem("https://pp.vk.me/c540402/u134197174/video/l_e86e215a.jpg", 'video', {
                            title:"Item " + (o + i),
                            icon:"https://pp.vk.me/c540402/u134197174/video/l_e86e215a.jpg",
                            description:"descriptions",
                            duration:500
                        });
        }
        new_offset(cnt + o);
    }, 750);
}

new page.Route('asyncPageLoad:test:(.*)', function(page, arg1) {
    var offset = 0;
    page.type = "directory";
    page.contents = 'movies';
    (page.asyncPaginator = function loader() {
        page.loading = true;
        items(page, offset, function(new_offset){
            print("new offset" + new_offset);
            offset = new_offset;
            page.loading = false;
            page.haveMore(true);
        });
    })();
});

Repro rate 45% in this test code.
In vk plugin repro rate 80%


Related issues

Copied from Bug #2580: Async paginators called simultaneously Invalid 03/11/2015

Associated revisions

Revision 701d2253
Added by Andreas Smas over 3 years ago

pagination: Fix various race conditions

refs #2946

Change included in version 5.0.150

History

#1 Updated by Anatoly Shcherbinin almost 4 years ago

  • Copied from Bug #2580: Async paginators called simultaneously added

#2 Updated by Andreas Smas almost 4 years ago

  • Status changed from New to Need feedback

Right, but this is (somehow?) fixed in master branch right?

#3 Updated by Anatoly Shcherbinin almost 4 years ago

Last time it was master branch and 4.10 not existed yet. And then it became hard to reproduce in test app. In vk plugin problem still notable.

#4 Updated by Andreas Smas almost 4 years ago

I tested on master now with the test app and couldn't reproduce it. However on 4.10 i can. There's been a bunch of changes so it's a bit hard to tell what/if fixed it.

#5 Updated by Andreas Smas over 3 years ago

  • Target version changed from 4.10 to 5.2

#6 Updated by Andreas Smas over 3 years ago

  • Status changed from Need feedback to Fixed

The new youtube plugin uses async paginators all over and it seems to work fine.

Also available in: Atom PDF