Prevent instantiating a new BulkEdit react component with every click

pull/618/head
sachaaaaa 5 years ago
parent 2b6bd7e04a
commit bd9a900a1b

@ -8,33 +8,26 @@
Whisper.BulkEditView = Whisper.View.extend({
initialize(options) {
this.selectedMessages = new Set();
this.render();
this.onCancel = options.onCancel;
this.onDelete = options.onDelete;
},
render() {
if (this.memberView) {
this.memberView.remove();
this.memberView = null;
}
this.props = {
onCancel: options.onCancel,
onDelete: options.onDelete,
messageCount: 0,
};
this.memberView = new Whisper.ReactWrapperView({
className: 'bulk-edit-view',
Component: window.Signal.Components.BulkEdit,
props: {
messageCount: this.selectedMessages.size,
onCancel: this.onCancel,
onDelete: this.onDelete,
},
props: this.props,
});
this.$el.append(this.memberView.el);
return this;
},
render() {
this.memberView.update(this.props);
},
update(selectedMessages) {
this.selectedMessages = selectedMessages;
update(selectionSize) {
this.props.messageCount = selectionSize;
this.render();
},
});

@ -1797,7 +1797,7 @@
$('.compose').show();
}
this.bulkEditView.update(this.model.selectedMessages);
this.bulkEditView.update(selectionSize);
},
resetMessageSelection() {

Loading…
Cancel
Save