Skip to content

Commit

Permalink
Fix: Query parameters don't have stickiness between different model i…
Browse files Browse the repository at this point in the history
…n ember-engine
  • Loading branch information
Raja Alauddin Raja Abdullah committed Jan 11, 2017
1 parent 6949762 commit b4328dd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -586,8 +586,11 @@ moduleFor('Application test: engine rendering', class extends ApplicationTest {
});

return this.visit('/blog/category/1?type=news').then(() => {
let suffix = '/blog/category/1337';
let href = this.element.querySelector('a').href;
assert.equal(href.match(/type=news/), null);

// check if link ends with the suffix
assert.notEqual(href.indexOf(suffix, href.length - suffix.length), -1);
});
}
});
4 changes: 2 additions & 2 deletions packages/ember-routing/lib/system/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -1334,7 +1334,7 @@ let Route = EmberObject.extend(ActionHandler, Evented, {
let aQp = queryParams.map[prop];

aQp.values = params;
let cacheKey = calculateCacheKey(aQp.controllerName, aQp.parts, aQp.values);
let cacheKey = calculateCacheKey(aQp.route.fullRouteName, aQp.parts, aQp.values);

if (cache) {
let value = cache.lookup(cacheKey, prop, aQp.undecoratedDefaultValue);
Expand Down Expand Up @@ -1363,7 +1363,7 @@ let Route = EmberObject.extend(ActionHandler, Evented, {
_qpChanged(prop, value, qp) {
if (!qp) { return; }

let cacheKey = calculateCacheKey(qp.controllerName, qp.parts, qp.values);
let cacheKey = calculateCacheKey(qp.route.fullRouteName, qp.parts, qp.values);

// Update model-dep cache
let cache = this._bucketCache;
Expand Down
2 changes: 1 addition & 1 deletion packages/ember-routing/lib/system/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -953,7 +953,7 @@ const EmberRouter = EmberObject.extend(Evented, {
delete queryParams[presentProp];
}
} else {
let cacheKey = calculateCacheKey(qp.controllerName, qp.parts, state.params);
let cacheKey = calculateCacheKey(qp.route.fullRouteName, qp.parts, state.params);
queryParams[qp.scopedPropertyName] = appCache.lookup(cacheKey, qp.prop, qp.defaultValue);
}
}
Expand Down

0 comments on commit b4328dd

Please sign in to comment.