From 7f96b4c95cfbbc105baeef28193a575e5e3db4c8 Mon Sep 17 00:00:00 2001 From: sachaaaaa Date: Fri, 15 Nov 2019 10:02:11 +1100 Subject: [PATCH] lazy instantiation --- js/views/bulk_edit_view.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/js/views/bulk_edit_view.js b/js/views/bulk_edit_view.js index c29f8401c..ec6b37301 100644 --- a/js/views/bulk_edit_view.js +++ b/js/views/bulk_edit_view.js @@ -8,12 +8,18 @@ Whisper.BulkEditView = Whisper.View.extend({ initialize(options) { + this.memberView = null; this.props = { onCancel: options.onCancel, onDelete: options.onDelete, messageCount: 0, }; - + }, + render() { + if (this.memberView) { + this.memberView.update(this.props); + return; + } this.memberView = new Whisper.ReactWrapperView({ className: 'bulk-edit-view', Component: window.Signal.Components.BulkEdit, @@ -22,9 +28,6 @@ this.$el.append(this.memberView.el); }, - render() { - this.memberView.update(this.props); - }, update(selectionSize) { this.props.messageCount = selectionSize;