mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2025-02-17 00:21:20 -05:00
revised comments
This commit is contained in:
parent
0d4d6a9adc
commit
3bc6e7ff6f
1 changed files with 3 additions and 1 deletions
|
@ -34,7 +34,8 @@ class UsernameStep extends React.Component {
|
|||
focused: null,
|
||||
showPassword: false
|
||||
};
|
||||
// keeps us from submitting multiple remote requests for a single username
|
||||
// simple object to memoize remote requests for usernames.
|
||||
// keeps us from submitting multiple requests for same data.
|
||||
this.usernameRemoteCache = {};
|
||||
}
|
||||
componentDidMount () {
|
||||
|
@ -52,6 +53,7 @@ class UsernameStep extends React.Component {
|
|||
handleSetUsernameRef (usernameInputRef) {
|
||||
this.usernameInput = usernameInputRef;
|
||||
}
|
||||
// simple function to memoize remote requests for usernames
|
||||
validateUsernameRemotelyWithCache (username) {
|
||||
if (this.usernameRemoteCache.hasOwnProperty(username)) {
|
||||
return Promise.resolve(this.usernameRemoteCache[username]);
|
||||
|
|
Loading…
Reference in a new issue