fix(settings): unblock rendering of settings on communication prefs screen #3088
Conversation
806dff2
to
a1226c4
|
@zaach - With this diff applied, I see some unexpected behavior: diff --git a/app/scripts/lib/marketing-email-client.js b/app/scripts/lib/marketing-email-client.js
index b30f3f1..8b6c641 100644
--- a/app/scripts/lib/marketing-email-client.js
+++ b/app/scripts/lib/marketing-email-client.js
@@ -42,6 +42,8 @@ define([
var self = this;
return this._request('get', '/lookup-user', accessToken)
.then(function (response) {
+ throw MarketingEmailErrors.toError('NETWORK_FAILURE');
+
// TODO
// I would prefer to place this into the MarketingEmailPrefs model
// but doing so required passing around the preferencesUrl to lots ofNo error message is displayed. Expected? |
a1226c4
to
d9f8b24
6b2d48c
to
7cb060a
7cb060a
to
9e97ce2
| return emailPrefs.fetch() | ||
| .fail(function (err) { | ||
| .then(function () { | ||
| return self.render(); |
shane-tomlinson
Sep 29, 2015
Member
For this PR this approach is fine, but it does allow for a flash of button content if the user reloads the page with the communications_preferences panel open:
A solution to this is to render the page with a "loading" button (gray button with throbber) while the fetch is outstanding, then re-render the button (or the entire screen) with the appropriate text once the emailPrefs fetch has completed.
Since re-loading the page with the communication prefs screen is probably not a common occurrence, "meh" for now.
For this PR this approach is fine, but it does allow for a flash of button content if the user reloads the page with the communications_preferences panel open:
A solution to this is to render the page with a "loading" button (gray button with throbber) while the fetch is outstanding, then re-render the button (or the entire screen) with the appropriate text once the emailPrefs fetch has completed.
Since re-loading the page with the communication prefs screen is probably not a common occurrence, "meh" for now.
9e97ce2
to
2118e53
|
If all the tests go green, r+, thanks @zaach! |
|
@zaach - the |
|
@shane-tomlinson I can't reproduce– have you made sure to rebuild the SASS files? |
I'll re-check to make sure, I'd guess this as the most likely cause of the issue. |
|
@zaach - I had two problems, the first is I needed to regenerate the SASS, the second is I had a fake-basket-server that intentionally introduced delay in responding. |
…king fix(settings): unblock rendering of settings on communication prefs screen r=@shane-tomlinson Thanks @zaach!
PR #3088 sped up the rendering of the settings page but introduced a regression in the communication preferences tests. Communication preferences are re-rendered after an XHR request to Basket is made to check whether the user has opted in to email communcations. The Selenium tests moved to quickly and clicked the "open panel" button using an element that was sometimes no longer in the DOM (sometimes meaning sometimes the response to basket took a while and the prefs opened, other times basket finished early and Selenium's reference was stale). This PR fixes this by adding a `basket-ready` class to the `#communication-preferences` element when rendering is complete. Selenium looks for this class name, and then continues. fixes #3357
PR #3088 sped up the rendering of the settings page but introduced a regression in the communication preferences tests. Communication preferences are re-rendered after an XHR request to Basket is made to check whether the user has opted in to email communcations. The Selenium tests moved to quickly and clicked the "open panel" button using an element that was sometimes no longer in the DOM (sometimes meaning sometimes the response to basket took a while and the prefs opened, other times basket finished early and Selenium's reference was stale). This PR fixes this by adding a `basket-ready` class to the `#communication-preferences` element when rendering is complete. Selenium looks for this class name, and then continues. fixes #3357

Fixes #3061. Using
afterVisiblefrom subviews does not block rendering of the settings page.@shane-tomlinson r?