Last active
March 27, 2018 01:42
-
-
Save ispiders/eddfe31a08d04ea9301b7a7ec77d2413 to your computer and use it in GitHub Desktop.
RecordArrayManager.prototype._syncLiveRecordArray bug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle' | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import DS from 'ember-data'; | |
export default DS.Model.extend({ | |
name: DS.attr('string') | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import DS from 'ember-data'; | |
import Ember from 'ember'; | |
export default DS.Model.extend({ | |
name: DS.attr('string'), | |
// async relation to trigger `RecordArrayManager._pending` while compute `authors` | |
group: DS.belongsTo('group', {async: true}), | |
users: Ember.computed(function () { | |
return this.store.peekAll('user'); | |
}), | |
authors: Ember.computed('users.@each.name', function () { | |
return this.get('users').mapBy('name').join(','); | |
}) | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Model from "ember-data/model"; | |
import attr from "ember-data/attr"; | |
export default Model.extend({ | |
name: attr('string') | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Route.extend({ | |
model: function () { | |
let store = this.store; | |
// mock data | |
store.push({ | |
data: [{ | |
type: 'user', | |
id: '1', | |
attributes: { | |
name: 'user 1' | |
} | |
},{ | |
type: 'user', | |
id: '2', | |
attributes: { | |
name: 'user 2' | |
} | |
}], | |
included: [{ | |
type: 'post', | |
id: '1', | |
attributes: { | |
name: 'post 1' | |
}, | |
relationships: { | |
group: { | |
data: { | |
type: 'group', | |
id: '1' | |
} | |
} | |
} | |
},{ | |
type: 'post', | |
id: '2', | |
attributes: { | |
name: 'post 2' | |
}, | |
relationships: { | |
group: { | |
data: { | |
type: 'group', | |
id: '1' | |
} | |
} | |
} | |
}], | |
}); | |
return { | |
posts: store.peekAll('post') | |
}; | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.12.1", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "https://cdn.bootcss.com/ember.js/2.16.1/ember.debug.js", | |
"ember-template-compiler": "release", | |
"ember-data": "https://cdn.bootcss.com/ember-data.js/2.16.1/ember-data.prod.js" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment