ignore stale `users/show` responses - fixes #741
* person starts typing "abcd" * request for user "abcd" is sent to server * person continues typing "ef" * request for user "abcdef" is sent to server * response for user "abcdef" arrives, icon for user "abcdef" is shown * response for user "abcd" arrives, icon for user "abcd" was shown – with this commit, this response is ignored instead This is not just "showing the wrong avatar", btw: `MkSignin` uses the `user` variable to decide whether to use 2FA, so having the wrong data in user can make a login attempt fail.
This commit is contained in:
parent
f3e6b43ea4
commit
5af38db74b
|
@ -110,7 +110,9 @@ function onUsernameChange(): void {
|
|||
misskeyApi('users/show', {
|
||||
username: username.value,
|
||||
}).then(userResponse => {
|
||||
user.value = userResponse;
|
||||
if (userResponse.username === username.value) {
|
||||
user.value = userResponse;
|
||||
}
|
||||
}, () => {
|
||||
user.value = null;
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue