Skip to content

Commit e10ff59

Browse files
author
Boudewijn van Groos
committed
[BUGFIX release] Query params refreshModel
Issue: #15801 Reproduces the case of a refresh due to a queryParam transition in a child route. *Still requires actual fix.*
1 parent f5d0ded commit e10ff59

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

packages/ember/tests/routing/router_service_test/transitionTo_test.js

+41
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,47 @@ if (EMBER_ROUTING_ROUTER_SERVICE) {
302302
});
303303
}
304304

305+
['@test RouterService#transitionTo with refreshModel on parent route'](assert) {
306+
assert.expect(2);
307+
308+
this.add('controller:parent', Controller.extend({
309+
queryParams: ['parentParam'],
310+
parentParam: null
311+
}));
312+
313+
let modelCalled = 0;
314+
315+
this.add('route:parent', Route.extend({
316+
queryParams: {
317+
parentParam: {
318+
refreshModel: true
319+
}
320+
},
321+
322+
model() {
323+
modelCalled++;
324+
return {};
325+
}
326+
}));
327+
328+
this.add('controller:parent.child', Controller.extend({
329+
queryParams: ['childParam']
330+
}));
331+
332+
let queryParams = this.buildQueryParams({ childParam: 'other' })
333+
334+
return this.visit('/child')
335+
.then(() => {
336+
console.log('Second');
337+
assert.equal(modelCalled, 1, "Model called from first load");
338+
return this.routerService.transitionTo(queryParams);
339+
})
340+
.then(() => {
341+
console.log('Third');
342+
assert.equal(modelCalled, 1, "Model should not be called again");
343+
});
344+
}
345+
305346
['@test RouterService#transitionTo with aliased query params uses the original provided key'](assert) {
306347
assert.expect(1);
307348

0 commit comments

Comments
 (0)