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

save() on embedded record causes re-render #59

Closed
rickharrison opened this issue May 2, 2014 · 1 comment
Closed

save() on embedded record causes re-render #59

rickharrison opened this issue May 2, 2014 · 1 comment

Comments

@rickharrison
Copy link

I have a model structure as following:

var ListModel = DS.Model.extend({
  name: DS.attr('string'),
  items: DS.hasMany('item', { embedded: true })
});

var ItemModel = DS.Model.extend({
  title: DS.attr('string'),
  completed: DS.attr('boolean', { defaultValue: false })
});

To display these items, I have a view with syntax like this:

{{each items}}
  <li>{{input value=title}}</li>
{{/each}}

Changing the value of the input will then change the value of the title of the ItemModel, which is embedded in a ListModel. Now, if I am observing a change on the title and I try to persist that to firebase with ListModel.save(), everything works great. The change is represented on the firebase data set. However, that causes an entire re-render of the {{each}} block which causes the input to lose focus. Is there anyway to call save() without causing a re-render? especially because no values are changing locally, changes should only be pushed up server side.

igorT added a commit to igorT/emberfire that referenced this issue Oct 6, 2014
Upgrade to Ember-Data beta.10

The adapter event subscribing to Firebase events now lives
in the afterPush hook instead of being scattered around the adapter.

Embedded processing has been refactored to recursively normalize embedded
records, bringing it more in line with the EmbeddedRecordsMixin(maybe we should
use it at some point), simplyfying the code and fixing several embedded related
bugs.

Tests are now more functional allowing for easier refactors.
Tests have been refactored, for easier reading/writing and less
interdependence.

Lots of new tests added

Grunt now watches for changes and rebuilds correctly

Various other fixes, refactors and cleanups.

fixes FirebaseExtended#129 fixes FirebaseExtended#103 fixes FirebaseExtended#124 fixes FirebaseExtended#121 fixes FirebaseExtended#94
should also fix, but lacking tests for  FirebaseExtended#114 FirebaseExtended#96 FirebaseExtended#59
igorT added a commit to igorT/emberfire that referenced this issue Oct 6, 2014
Upgrade to Ember-Data beta.10

The adapter event subscribing to Firebase events now lives
in the afterPush hook instead of being scattered around the adapter.

Embedded processing has been refactored to recursively normalize embedded
records, bringing it more in line with the EmbeddedRecordsMixin(maybe we should
use it at some point), simplyfying the code and fixing several embedded related
bugs.

Tests are now more functional allowing for easier refactors.
Tests have been refactored, for easier reading/writing and less
interdependence.

Lots of new tests added

Grunt now watches for changes and rebuilds correctly

Various other fixes, refactors and cleanups.

fixes FirebaseExtended#129 fixes FirebaseExtended#103 fixes FirebaseExtended#124 fixes FirebaseExtended#121 fixes FirebaseExtended#94 fixes FirebaseExtended#88
should also fix, but lacking tests for  FirebaseExtended#114 FirebaseExtended#96 FirebaseExtended#59 FirebaseExtended#44
@sararob
Copy link
Contributor

sararob commented Dec 10, 2014

@rickharrison @igorT fixed this in #133 but it still needs tests. Let me know if you're still having issues. I'm closing this and will add another issue to write a test for this.

@sararob sararob closed this as completed Dec 10, 2014
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

2 participants