From 5f1b8633c7fa26eb212b24ec631b22b84f8b8991 Mon Sep 17 00:00:00 2001 From: Evan Morikawa Date: Fri, 12 Feb 2016 10:56:36 -0800 Subject: [PATCH] fix(analytics): delay closing of onboarding window --- .../onboarding/lib/page-router-store.coffee | 9 ++++++++- .../search-bar/lib/search-suggestion-store.coffee | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/internal_packages/onboarding/lib/page-router-store.coffee b/internal_packages/onboarding/lib/page-router-store.coffee index b8f237a57..ca785869a 100644 --- a/internal_packages/onboarding/lib/page-router-store.coffee +++ b/internal_packages/onboarding/lib/page-router-store.coffee @@ -32,7 +32,14 @@ class PageRouterStore extends NylasStore @_onMoveToPage('initial-preferences', {account: json}) Actions.recordUserEvent('First Account Linked') else - ipcRenderer.send('account-setup-successful') + # When account JSON is received, we want to notify external services + # that it succeeded. Unfortunately in this case we're likely to + # close the window before those requests can be made. We add a short + # delay here to ensure that any pending requests have a chance to + # clear before the window closes. + setTimeout -> + ipcRenderer.send('account-setup-successful') + , 100 _onWindowPropsChanged: ({page, pageData}={}) => @_onMoveToPage(page, pageData) diff --git a/internal_packages/search-bar/lib/search-suggestion-store.coffee b/internal_packages/search-bar/lib/search-suggestion-store.coffee index ae28633d4..26ae51290 100644 --- a/internal_packages/search-bar/lib/search-suggestion-store.coffee +++ b/internal_packages/search-bar/lib/search-suggestion-store.coffee @@ -42,6 +42,7 @@ class SearchSuggestionStore extends NylasStore current = FocusedPerspectiveStore.current() if @queryPopulated() + Actions.recordUserEvent("Commit Search Query", {}) @_perspectiveBeforeSearch ?= current next = MailboxPerspective.forSearch(current.accountIds, @_searchQuery.trim()) Actions.focusMailboxPerspective(next)