Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracked array not causing re-render when updated in Octane project #17931

Closed
JonForest opened this issue Apr 16, 2019 · 2 comments
Closed

Tracked array not causing re-render when updated in Octane project #17931

JonForest opened this issue Apr 16, 2019 · 2 comments

Comments

@JonForest
Copy link

Referencing a conversation with @pzuraq on the Discord #help channel.

I have a component that is updating a particular ember data model within an array of models within an action. The template is not updating, even though this array is used within getters that are in turn used within the template.

Component code is here:

export default class BehaviourGrid extends Component {
  @tracked behaviours

  constructor (owner, args) {
    super(...arguments)
    this.behaviours = args.behaviours.slice(0)
  }

  get unallocated() {
    return this.behaviours.filter(behaviour => behaviour.list === 'unallocated')
  }

  get self() {
    return this.behaviours.filter(behaviour => behaviour.list === 'self')
  }

  // ... other getters
  @action
  moveBehaviour(toList, id) {
    const behaviour = this.args.behaviours.find(behaviour => behaviour.id === id)
    behaviour.set('list', toList)
    // Fire the setter
    this.behaviours = this.behaviours
  }
}

If I output a length of this.unallocated before and after the set in the action then I can see it is being updated, but no template re-render.

The git repo is here (super simple for easy reproduction): https://github.com/JonForest/leadership-quiz

@rwjblue
Copy link
Member

rwjblue commented Apr 23, 2019

@JonForest - I believe this should have been addressed by #17751, would you mind updating to the latest canary build and confirming?

@JonForest
Copy link
Author

Awesome, that's got it. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants