Durandal ViewModels activate repeatedly after 2.0.0 upgrade -


i upgrading durandal project 1.2.0 version 2.0.0. have followed steps in durandal documentation (http://durandaljs.com/documentation/conversion-guide/) , app functions usual now. issue seeing activate callback keeps getting called on , on again.

here 1 of viewmodels doing it:

define(['services/datacontext', 'plugins/router', 'services/logger', 'services/model', 'services/images', 'services/pager'],     function (datacontext, router, logger, model, images, pager) {          var collaborators = ko.observablearray([]);         var filterstring = ko.observable();         var pagehandler = new pager();          var activate = function (filter) {             return q.all([datacontext.getall(model.entitynames.songwriter + 's', "", collaborators, { orderby: "firstname" })])                     .then(dataretrieved)                     .then(activatepager);              function dataretrieved() {             };              function activatepager() {                 pagehandler.init.call(pagehandler, collaborators(), {                     pagesize: 12,                     filtercallback: function (item) {                         var filter = filterstring().tolowercase();                          var pred1 = item.fullname().tolowercase().indexof(filter) >= 0;                          return pred1;                     }                 });                 if (filter != null) {                     filterstring(filter);                     pagehandler.applyfilter.call(pagehandler);                 }             };         };          var deactivate = function () {         };          var vm = {             activate: activate,             deactivate: deactivate,             collaborators: pagehandler.displayitems,             title: 'collaborators',             images: images,             router: router,             pager: pagehandler,             filterstring: filterstring         };          return vm;     }); 

has seen before?

here chrome console output:

chrome console

edit
doesn't seem happening on viewmodels, 1 fine..

define(['durandal/app', 'services/datacontext', 'plugins/router', 'services/logger', 'services/model', 'viewmodels/shared/leftnav', 'viewmodels/modals/imagecrop', 'services/images'],     function (app, datacontext, router, logger, model, leftnav, imagecrop, images) {         leftnav.area("songwriter");          var songwriter = ko.observable();         var songwriterid = ko.observable();         var publishers = ko.observablearray([]);         var pros = ko.observablearray([]);          var activate = function (id) {             songwriterid(id);             leftnav.entityid(songwriterid());              return q.all([datacontext.getentitybyid(model.entitynames.songwriter, songwriterid(), "publisher, pro", songwriter),                           datacontext.getall(model.entitynames.publisher + 's', "", publishers),                           datacontext.getall(model.entitynames.pro + 's', "", pros)]);         };          var deactivate = function () {             if (datacontext.haschanges()) {                 datacontext.cancelchanges();             }         };          var saveclick = function () {             datacontext.savechanges().then(savecomplete);              function savecomplete() {                 router.navigateback();             };         };          var cancelclick = function () {             router.navigateback();         };          var imageuploaded = function (e) {             logger.logsuccess("image uploaded successfully", e.response, "profile", true);             songwriter().photofilepath('/azure/profileimages/' + e.response);              app.showdialog(imagecrop, {                 title: 'crop profile image',                 message: '<i class="icon-info-sign"></i> profile image needs cropped ensure not appear distorted.',                 filepath: songwriter().photofilepath()             }).then(appendcropinfo);              function appendcropinfo(coords) {                 var path = songwriter().photofilepath;                  path(path() + '?crop=(' + coords.x + ',' + coords.y + ',' + coords.x2 + ',' + coords.y2 + ')');             };         };           var vm = {             activate: activate,             deactivate: deactivate,             songwriter: songwriter,             publishers: publishers,             pros: pros,             title: 'songwriter',             cancelclick: cancelclick,             saveclick: saveclick,             imageuploaded: imageuploaded,             images: images         };          return vm;     }); 

edit - stack trace

activate (details.js:11) invoke (activator.js:52) activate (activator.js:99) (anonymous function) (activator.js:308) (anonymous function) (jquery-2.0.3.js:3070) fire (jquery-2.0.3.js:2914) self.add (jquery-2.0.3.js:2960) (anonymous function) (jquery-2.0.3.js:3069) jquery.extend.each (jquery-2.0.3.js:590) (anonymous function) (jquery-2.0.3.js:3065) jquery.extend.deferred (jquery-2.0.3.js:3126) promise.then (jquery-2.0.3.js:3064) (anonymous function) (activator.js:306) (anonymous function) (jquery-2.0.3.js:3070) fire (jquery-2.0.3.js:2914) self.add (jquery-2.0.3.js:2960) (anonymous function) (jquery-2.0.3.js:3069) jquery.extend.each (jquery-2.0.3.js:590) (anonymous function) (jquery-2.0.3.js:3065) jquery.extend.deferred (jquery-2.0.3.js:3126) promise.then (jquery-2.0.3.js:3064) (anonymous function) (activator.js:302) (anonymous function) (jquery-2.0.3.js:3070) fire (jquery-2.0.3.js:2914) self.add (jquery-2.0.3.js:2960) (anonymous function) (jquery-2.0.3.js:3069) jquery.extend.each (jquery-2.0.3.js:590) (anonymous function) (jquery-2.0.3.js:3065) jquery.extend.deferred (jquery-2.0.3.js:3126) promise.then (jquery-2.0.3.js:3064) (anonymous function) (activator.js:300) jquery.extend.deferred (jquery-2.0.3.js:3126) system.defer (system.js:218) computed.activateitem (activator.js:285) activateroute (router.js:248) handleguardedroute (router.js:303) ensureactivation (router.js:313) (anonymous function) (router.js:357) (anonymous function) (jquery-2.0.3.js:3070) fire (jquery-2.0.3.js:2914) self.firewith (jquery-2.0.3.js:3026) deferred.(anonymous function) (jquery-2.0.3.js:3115) (anonymous function) (system.js:256) 

edit - route

the route configured follows:

{ route: 'songwriter/:id', moduleid: 'songwriter/details', nav: true, title: 'profile', settings: { icon: 'icon-edit' } }, 

can same problem observing after upgrade 2.0. have posted similar case @ durandal google group: https://groups.google.com/forum/m/?fromgroups#!topic/durandaljs/roq8effb1tm

i created repo reproduce problem: https://github.com/stiankroknes/durandal-router-problem


Comments

Popular posts from this blog

design - Custom Styling Qt Quick Controls -

Unable to remove the www from url on https using .htaccess -