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

Deleting object keys doesn't update children component templates #15847

Closed
catc opened this issue Nov 10, 2017 · 2 comments
Closed

Deleting object keys doesn't update children component templates #15847

catc opened this issue Nov 10, 2017 · 2 comments

Comments

@catc
Copy link

catc commented Nov 10, 2017

Reproduced at https://ember-twiddle.com/5cdc151106ba73d08ce4f5da63c0736e?numColumns=2&openFiles=templates.components.my-comp.hbs%2Ctemplates.components.option-item.hbs

  • add an item
  • remove it
  • the remove button string changes to add in the same component template
  • the remove button doesn't update in children components (bug)

Deleting a key on an Ember.Object correctly updates the template on the current component, but fails to update the templates of children components.

@christophermlne
Copy link

I think the real issue (as shown in the Twiddle) is that this.notifyPropertyChange doesn't update observers in children. From my reading on similar issues that have been filed, that appears to be a design decision. That feels wrong though. I would have expected this.notifyPropertyChange to update all observers.

It also seems odd that there is no way to delete keys from an ember object that will trigger all observers. We have getters and setters, but no 'deleters'...

@rwjblue
Copy link
Member

rwjblue commented Dec 8, 2018

As @christophermlne mentioned, the notification is effectively being "absorbed" and since the actual selected item does not change the inner option-item is never going to consider selected as changed. This is an intentional choice, but I can absolutely see how you might think it is a bug.

Soon there will be alternative ways to do this sort of thing (e.g. emberjs/rfcs#410) which will be much more intuitive.

Closing for now, since this doesn't seem to be a bug (though again I totally agree that this is non-obvious behavior)....

@rwjblue rwjblue closed this as completed Dec 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants