Skip to content

Commit b24e98e

Browse files
authored
Merge pull request #802 from mixonic/mixonic/3.15-compat
Avoid "update prop already used in computation"
2 parents 040df20 + d923e47 commit b24e98e

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ before_install:
6666
- export PATH=$HOME/.yarn/bin:$PATH
6767

6868
install:
69-
- yarn install --no-lockfile --non-interactive
69+
- yarn install --no-lockfile --non-interactive --ignore-engines
7070

7171
script:
7272
# Usually, it's ok to finish the test scenario without reverting

addon/components/ember-tbody/component.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import Component from '@ember/component';
22

3+
import { run } from '@ember/runloop';
34
import { computed } from '@ember/object';
45
import { observer } from '../../-private/utils/observer';
56
import { bool, readOnly, or } from '@ember/object/computed';
@@ -234,7 +235,9 @@ export default Component.extend({
234235
*/
235236
canSelect: bool('onSelect'),
236237

237-
'data-test-row-count': readOnly('wrappedRows.length'),
238+
dataTestRowCount: null,
239+
240+
'data-test-row-count': readOnly('dataTestRowCount'),
238241

239242
init() {
240243
this._super(...arguments);
@@ -297,7 +300,7 @@ export default Component.extend({
297300

298301
/**
299302
Computed property which updates the CollapseTree and erases caches. This is
300-
a computed for 1.11 compatibility, otherwise it would make sense to use
303+
a computed for 1.12 compatibility, otherwise it would make sense to use
301304
lifecycle hooks instead.
302305
*/
303306
wrappedRows: computed('rows', function() {
@@ -306,6 +309,11 @@ export default Component.extend({
306309
this.collapseTree.set('rowMetaCache', this.rowMetaCache);
307310
this.collapseTree.set('rows', rows);
308311

312+
run.schedule('actions', () => {
313+
// eslint-disable-next-line ember-best-practices/no-side-effect-cp
314+
this.set('dataTestRowCount', this.get('wrappedRows.length')); // eslint-disable-line ember/no-side-effects
315+
});
316+
309317
return this.collapseTree;
310318
}),
311319

0 commit comments

Comments
 (0)