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

Fix Ember 2.0 no longer supporting dependent keys ending in "@each" #125

Closed

Conversation

mcm-ham
Copy link
Contributor

@mcm-ham mcm-ham commented Aug 15, 2015

No description provided.

mcm-ham added a commit to crossroads/browse.goodcity that referenced this pull request Aug 15, 2015
* can switch back to ember-cli-pagination when mharris717/ember-cli-pagination#125 is closed
@broerse
Copy link
Collaborator

broerse commented Aug 15, 2015

Reading this

Note here that we use the special key [] instead of @each.foo (which is used for observing a specific dependent key, such as foo, on each item). This instructs Ember.js to only care about the array itself changing (such as adding/removing items), rather than changes to the items themselves.

I am not sure .[] is the same as .@each Can you point me to some docs?

@mcm-ham
Copy link
Contributor Author

mcm-ham commented Aug 15, 2015

The @each syntax also monitors for changes to array just like []; from docs for [email protected]:

1. The isDone property of any of the objects in the todos array changes.
2. An item is added to the todos array.
3. An item is removed from the todos array.
4. The todos property of the controller is changed to a different array.

Indeed the docs as far as I'm aware has always encouraged todos.[] usage over todos.@each but the latter still worked until emberjs/ember.js#11990 hence it now doesn't work in Ember 2.0 (the intended usage for @each of [email protected] still works).

@broerse
Copy link
Collaborator

broerse commented Aug 15, 2015

Thanks. I was not sure 1. was handled by .[]

I will add it to https://github.com/broerse/ember-cli-pagination/tree/upgrade_027 . Only 18 tests failing now. If you have time please take a look.

@mcm-ham
Copy link
Contributor Author

mcm-ham commented Aug 15, 2015

Thanks. I was not sure 1. was handled by .[]

You are right only 2-4 is handled by '[]'; just that in our case we've not specified a property on the objects in the array to observe for changes i.e. we have content.@each not [email protected].

I will add it to https://github.com/broerse/ember-cli-pagination/tree/upgrade_027 . Only 18 tests failing now. If you have time please take a look.

Thanks. I don't think I do have that time sorry, but if I do I will have a look.

@broerse
Copy link
Collaborator

broerse commented Aug 20, 2015

@mcm-ham This is now in the new 0.9.0 Thanks!

@mharris717
Copy link
Owner

@mcm-ham thanks for taking the time to make this PR!

Closing, as your commit is in 0.9.0.

@mharris717 mharris717 closed this Aug 20, 2015
@mharris717
Copy link
Owner

And thanks for teaching me something, I didn't know that about [] vs each.

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

Successfully merging this pull request may close these issues.

3 participants