azicchetti/jquerymobile-router

handler getting called twice even when step "url" selected

chapak0 opened this issue · 1 comments

This is what my router looks like:

var katanarouter = new $.mobile.Router([
{"#home" : {handler: "findstorestart", events: "bs", argsre: true}},
{"#carmake" : {handler: "carmake", events: "bC", argsre: true, step: "url"}}
],

    {
        home : function(eventType, matchObj, ui, page, event) {
            // code here
            console.log("findstorestart handler");
        },  
        carmake : function(eventType, matchObj, ui, page, event) {
            // code here
            event.preventDefault();
            console.log("carmake handler");
            setTimeout(function(){
                getMakes(ui);   
            },600);

        }
    });

getmakes calls a webservice and returns data but the service gets called twice. Is there a known bug, or it's meant to work like this?

Uhm, with step=url the handler should be called just once.

Your code is very similar to the test-bC.html example, which seems to work well with jQM 1.3.x and with the new 1.4 alpha.

Can you please check whether getMakes() invokes ui.bCDeferred.resolve() to perform the page transition instead of calling $.mobile.changePage ?