Unverified Commit b6270812 authored by Benjamin Wheeler's avatar Benjamin Wheeler Committed by GitHub

Merge pull request #4002 from R4356th/patch-1

Change the way usernames are handled
parents 75dbbd02 364f6da1
...@@ -34,7 +34,7 @@ class UsernameStep extends React.Component { ...@@ -34,7 +34,7 @@ class UsernameStep extends React.Component {
}; };
// simple object to memoize remote requests for usernames. // simple object to memoize remote requests for usernames.
// keeps us from submitting multiple requests for same data. // keeps us from submitting multiple requests for same data.
this.usernameRemoteCache = {}; this.usernameRemoteCache = Object.create(null);
} }
componentDidMount () { componentDidMount () {
// Send info to analytics when we aren't on the standalone page. // Send info to analytics when we aren't on the standalone page.
...@@ -58,7 +58,7 @@ class UsernameStep extends React.Component { ...@@ -58,7 +58,7 @@ class UsernameStep extends React.Component {
} }
// simple function to memoize remote requests for usernames // simple function to memoize remote requests for usernames
validateUsernameRemotelyWithCache (username) { validateUsernameRemotelyWithCache (username) {
if (this.usernameRemoteCache.hasOwnProperty(username)) { if (typeof this.usernameRemoteCache[username] === 'object') {
return Promise.resolve(this.usernameRemoteCache[username]); return Promise.resolve(this.usernameRemoteCache[username]);
} }
// username is not in our cache // username is not in our cache
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment