0

Strange problem with Q and durandal 2.1

When i follow the instructions in Durandal docs and insert

system.defer = function (action) {
  var deferred = Q.defer();
  action.call(deferred, deferred);
  var promise = deferred.promise;
  deferred.promise = function() {
      return promise;
  };
  return deferred;
};

When i click on a link that uses the router it freaks out:

[Q] Unhandled rejection reasons (should be empty): 
    ["TypeError: undefined is not a function↵    at Obje…lhost:9020/Scripts/knockout-2.3.0.debug.js:954:38"]
    0: "TypeError: undefined is not a function↵    
at Object.composition.executeStrategy 
(http://localhost:9020/Scripts/durandal/composition.js:593:39)↵    
at Object.composition.inject    
(http://localhost:9020/Scripts/durandal/composition.js:622:22)↵    
at Object.composition.compose (http://localhost:9020/Scripts/durandal/composition.js:681:29)↵    
at ko.bindingHandlers.router.update    (http://localhost:9020/Scripts/durandal/plugins/router.js:1122:29)↵    
at http://localhost:9020/Scripts/knockout-2.3.0.debug.js:2155:33↵    
at Object.ko.utils.objectForEach (http://localhost:9020/Scripts/knockout-2.3.0.debug.js:54:17)↵    
at ko.dependentObservable.disposeWhenNodeIsRemoved (http://localhost:9020/Scripts/knockout-2.3.0.debug.js:2151:34)↵    
at evaluateImmediate (http://localhost:9020/Scripts/knockout-2.3.0.debug.js:1270:41)↵    
at evaluatePossiblyAsync [as callback] (http://localhost:9020/Scripts/knockout-2.3.0.debug.js:1236:13)↵    
at http://localhost:9020/Scripts/knockout-2.3.0.debug.js:954:38"
    length: 1
    __proto__: Array[0]

I am not sure what is causing the problem but if i comment out the [Q] patch it works perfectly. Is this a durandal 2.1 issue?

Piotr Stulinski
  • 9,241
  • 8
  • 31
  • 46

0 Answers0