Skip to content

Commit 30602c7

Browse files
committed
Merge branch 'master' into v2
2 parents 1bad5f9 + 172a56d commit 30602c7

File tree

7 files changed

+1005
-582
lines changed

7 files changed

+1005
-582
lines changed

CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
### 1.1.5
4+
- Avoid auto-tracking rerender assertion / infinite rerender during cancelation
5+
in certain contexts in Ember 3.15+ (#341, Fixes #340)
6+
7+
### 1.1.4
8+
- Avoid auto-tracking rerender assertion thrown in certain contexts in Ember 3.15+
9+
- Fix passing tasks into `action` helper directly on Ember 2.8 (yes, 2.8)
10+
311
### 1.1.3
412
- Fix issue where `rawTimeout`, `waitForEvent`, and `waitForQueue` helper timers
513
were not properly canceled or cleaned up in some cases, such as when used with

addon/-private/task-instance.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export class TaskInstance extends BaseTaskInstance {
7272

7373
getName() {
7474
if (!this.name) {
75-
this.name = this.get("task._propertyName") || "<unknown>";
75+
this.name = (this.task && this.task._propertyName) || "<unknown>";
7676
}
7777
return this.name;
7878
}

addon/-private/utils.js

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ let locations = [
2323
'@ember/-internals/glimmer',
2424
'ember-glimmer',
2525
'ember-glimmer/helpers/action',
26+
'ember-htmlbars/keywords/closure-action',
2627
'ember-routing-htmlbars/keywords/closure-action',
2728
'ember-routing/keywords/closure-action'
2829
];

config/ember-try.js

+11-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ module.exports = async function() {
1919
npm: {
2020
devDependencies: {
2121
'@ember/jquery': null,
22-
'ember-source': null
22+
'ember-source': null,
23+
'@embroider/macros': null
2324
}
2425
}
2526
},
@@ -33,12 +34,20 @@ module.exports = async function() {
3334
'ember': 'lts-2-8'
3435
}
3536
},
37+
npm: {
38+
devDependencies: {
39+
'@ember/jquery': null,
40+
'ember-source': null,
41+
'@embroider/macros': null
42+
}
43+
}
3644
},
3745
{
3846
name: 'ember-lts-2.12',
3947
npm: {
4048
devDependencies: {
41-
'ember-source': '~2.12.0'
49+
'ember-source': '~2.12.0',
50+
'@embroider/macros': null
4251
}
4352
}
4453
},

package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ember-concurrency",
3-
"version": "1.1.3",
3+
"version": "1.1.5",
44
"description": "Improved concurrency/async primitives for Ember.js",
55
"scripts": {
66
"build": "ember build",
@@ -17,6 +17,7 @@
1717
"@babel/core": "^7.6.4",
1818
"@ember/jquery": "^0.6.1",
1919
"@ember/optional-features": "^0.7.0",
20+
"@embroider/macros": "^0.10.0",
2021
"babel-eslint": "^10.0.3",
2122
"broccoli-asset-rev": "^3.0.0",
2223
"broccoli-clean-css": "^1.1.0",
@@ -44,6 +45,7 @@
4445
"ember-export-application-global": "^2.0.0",
4546
"ember-fn-helper-polyfill": "^1.0.2",
4647
"ember-load-initializers": "^2.0.0",
48+
"ember-modifier": "^1.0.2",
4749
"ember-notify": "^5.3.0",
4850
"ember-qunit": "^4.4.1",
4951
"ember-qunit-assert-helpers": "^0.2.2",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
import Component from '@ember/component';
2+
import { module, test } from 'qunit';
3+
import { setupRenderingTest } from 'ember-qunit';
4+
import { modifier } from 'ember-modifier';
5+
import { render } from '@ember/test-helpers';
6+
import hbs from 'htmlbars-inline-precompile';
7+
import { task, timeout } from 'ember-concurrency';
8+
import { gte } from 'ember-compatibility-helpers';
9+
10+
module('Integration | no render breaking', function(hooks) {
11+
setupRenderingTest(hooks);
12+
13+
if (gte('3.15.0')) {
14+
test('Issue #337 | internal task state updates do not trigger re-render assertions w/ auto-tracking', async function(assert) {
15+
assert.expect(1);
16+
17+
this.owner.register(
18+
'modifier:autofocus',
19+
modifier(function autofocus(element) {
20+
const childElement = element.querySelector('input');
21+
childElement.focus();
22+
})
23+
);
24+
25+
this.owner.register(
26+
'component:e-c-test',
27+
Component.extend({
28+
layout: hbs`<input>`,
29+
30+
focusIn() {
31+
this.exampleTask.perform();
32+
},
33+
34+
exampleTask: task(function*() {
35+
yield timeout(100);
36+
}),
37+
})
38+
);
39+
40+
await render(hbs`
41+
{{#macroIf (macroDependencySatisfies "ember-source" ">= 3.15.0")}}
42+
<ECTest {{autofocus}} />
43+
{{/macroIf}}
44+
`);
45+
assert.ok(true, "Renders");
46+
});
47+
48+
test('Issue #340 | internal task state updates in cancellation do not trigger re-render assertions w/ auto-tracking', async function(assert) {
49+
assert.expect(1);
50+
51+
this.owner.register(
52+
'component:e-c-test',
53+
Component.extend({
54+
layout: hbs`<div>{{this.value}}</div>`,
55+
56+
get value() {
57+
this._super(...arguments);
58+
59+
this.exampleTask.perform();
60+
this.exampleTask.perform();
61+
62+
return "value";
63+
},
64+
65+
exampleTask: task(function*() {
66+
yield timeout(100);
67+
}).restartable()
68+
})
69+
);
70+
71+
await render(hbs`<ECTest />`);
72+
assert.ok(true, "Renders");
73+
});
74+
}
75+
});

0 commit comments

Comments
 (0)