From 5af38db74bc54048c4221e3a2c4c736d11754a30 Mon Sep 17 00:00:00 2001 From: dakkar Date: Sat, 12 Oct 2024 18:16:06 +0100 Subject: [PATCH] ignore stale `users/show` responses - fixes #741 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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. --- packages/frontend/src/components/MkSignin.vue | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/frontend/src/components/MkSignin.vue b/packages/frontend/src/components/MkSignin.vue index 9813774da3..76a6537ccc 100644 --- a/packages/frontend/src/components/MkSignin.vue +++ b/packages/frontend/src/components/MkSignin.vue @@ -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; });