From f37af0481879ea4ad8d53282ff56032d19d66bbb Mon Sep 17 00:00:00 2001 From: Scott Nonnenberg Date: Fri, 28 Jul 2017 17:15:41 -0700 Subject: [PATCH] AppView.createInbox() - set this.inboxView immediately to be ready If the 'empty' event is fired between the updateInbox() call and the new InboxView() call afterwards, then the loading screen will never go away. We fix that by immediately creating the InboxView but only adding it to the DOM when the backing data is ready. FREEBIE --- js/views/app_view.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/js/views/app_view.js b/js/views/app_view.js index 10b15d243..b17342e9f 100644 --- a/js/views/app_view.js +++ b/js/views/app_view.js @@ -59,12 +59,14 @@ this.closeInstaller(); if (!this.inboxView) { + // We create the inbox immediately to make sure we're ready to receive the + // empty event after getting down to zero messages in the queue. + this.inboxView = new Whisper.InboxView({ + model: self, + window: window, + initialLoadComplete: options.initialLoadComplete + }); return ConversationController.loadPromise().then(function() { - this.inboxView = new Whisper.InboxView({ - model: self, - window: window, - initialLoadComplete: options.initialLoadComplete - }); this.openView(this.inboxView); }.bind(this)); } else {