mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-29 16:58:21 -05:00
Fix multi details sidebar collection initial fetch and render.
The switch from collection reset -> set caused the change handler in MultiDetails to immediately fire off a refreshListing. This change causes the collection contents to be loaded before the instantiation of the view (due to preload), and makes the view handle initial rendering of the collection contents in its constructor.
This commit is contained in:
@@ -8,13 +8,14 @@ r.multi = {
|
||||
|
||||
var detailsEl = $('.multi-details')
|
||||
if (detailsEl.length) {
|
||||
var multi = this.multis.touch(detailsEl.data('path')),
|
||||
detailsView = new r.multi.MultiDetails({
|
||||
model: multi,
|
||||
el: detailsEl
|
||||
})
|
||||
var multi = this.multis.touch(detailsEl.data('path'))
|
||||
multi.fetch()
|
||||
|
||||
var detailsView = new r.multi.MultiDetails({
|
||||
model: multi,
|
||||
el: detailsEl
|
||||
}).render()
|
||||
|
||||
if (location.hash == '#created') {
|
||||
detailsView.focusAdd()
|
||||
}
|
||||
@@ -229,14 +230,15 @@ r.multi.MultiDetails = Backbone.View.extend({
|
||||
r.ui.showWorkingDeferred(this.$el, xhr)
|
||||
}, this)
|
||||
|
||||
this.$('.subreddits').empty()
|
||||
this.itemViews = {}
|
||||
|
||||
this.bubbleGroup = {}
|
||||
this.addBubble = new r.multi.MultiAddNoticeBubble({
|
||||
parent: this.$('.add-sr .sr-name'),
|
||||
trackHover: false
|
||||
})
|
||||
|
||||
this.itemViews = {}
|
||||
this.$('.subreddits').empty()
|
||||
this.model.subreddits.each(this.addOne, this)
|
||||
},
|
||||
|
||||
render: function() {
|
||||
|
||||
Reference in New Issue
Block a user