lundi 29 juin 2015

Ember unable to transition to route

Suppose I was at abc.com/a?id=1 (Transition 1 T1), I want transitionToRoute to make a another full transition to abc.com/a?id=2 (Transition 2 T2).

T1: resolves correctly - a's model correctly in a's router and var t1 = this.transitionToRoute('a',{queryParams:{id:1}}) returns a healty object.

The promise object, below, of the transition dump is: "Router: Settle transition promise when transition is finalized"

Transition {state: TransitionState, intent: C, router: Router, data: Object, resolvedModels: Object…}
 _visibleQueryParams: Objectdata: 
ObjecthandlerInfos: Array[2]
intent: C
isActive: false
params: ObjectpivotHandler: Class
promise: Promise
queryParams: Objectresolve
Index: 1
resolvedModels: Object
router: Router
sequence: 2
state: TransitionState
targetName: "index"

Ok.

Now we are in the route of T1 , so in controller a, we send an action to bubble up to the index main application controller in order to re-transition to a with new set of parameters (T2).

T2: Resolves incorrectly with var t2 = this.transitionToRoute('a',{queryParam:{id:2}}. All parameters are missing objects, the intent is undefined and the promise reads "Router: Transition complete"

Transition {state: TransitionState, intent: undefined, router: Router, data: Object, resolvedModels: Object…}
_visibleQueryParams: Object
data: Object
intent: undefined
params: Object__proto__: Object
promise: Promise_id: 847_label: "Router: Transition complete"_onerror: null_result: TransitionState_state: 1
_subscribers: Array[0]
__proto__: Promisequery
Params: Object
__proto__: Object
__defineGetter__: __defineGetter__() { [native code] }__defineSetter__: __defineSetter__() { [native code] }__lookupGetter__: __lookupGetter__() { [native code] }__lookupSetter__: __lookupSetter__() { [native code] }constructor: Object() { [native code] }hasOwnProperty: hasOwnProperty() { [native code] }isPrototypeOf: isPrototypeOf() { [native code] }propertyIsEnumerable: propertyIsEnumerable() { [native code] }toLocaleString: toLocaleString() { [native code] }toString: toString() { [native code] }valueOf: valueOf() { [native code] }get __proto__: __proto__() { [native code] }set __proto__: __proto__() { [native code] }queryParamsOnly: trueresolvedModels: Object__proto__: Objectrouter: Routerstate: TransitionState__proto__: Object

I totaly don't understand why a second full transition to the same route, fails with changed parameters. I've tried to work around this, but as long as I'm calling the same route, transition objects are the same.

How would you update your model with a new parameter that you set?




Aucun commentaire:

Enregistrer un commentaire