Skip to content
This repository has been archived by the owner on Mar 5, 2018. It is now read-only.

Infinite loop when observing 'args' in a computed property that returns an array that is iterated over by {{#each}} #50

Closed
DecayConstant opened this issue Apr 6, 2017 · 4 comments

Comments

@DecayConstant
Copy link

DecayConstant commented Apr 6, 2017

import Component, {tracked} from "@glimmer/component";
export default class MyComponent extends Component {
    @tracked('args') get arrayTest() {
        console.log('bye');
        return [1, 2];
    }
};
<div>
    {{#each arrayTest key='@index' as |num|}}
         {{num}}
    {{/each}}
</div>

With the above component, and template, the computed property gets recomputed in an infinite loop. You'll see bye in the console forever.

If you remove {{num}} from the inside of the {{#each}}, the infinite loop does not happen.

@pittst3r
Copy link
Contributor

pittst3r commented Apr 6, 2017

Thank you! Good find!

Ping @tomdale

@CvX
Copy link

CvX commented Apr 9, 2017

(duplicate of #43)

@tomdale
Copy link
Contributor

tomdale commented Apr 9, 2017

This is a bad bug. Making args a tracked property is probably wrong because it means every time we set it during rerender we schedule a rerender. Probably we want to manually dirty the args tag instead of using a tracked property which installs a setter that schedules a rerender.

@tomdale
Copy link
Contributor

tomdale commented Jul 8, 2017

This got fixed awhile ago. Thank you for reporting!

@tomdale tomdale closed this as completed Jul 8, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants