From bf6ca8efdc146f817d473df4ebaf43bdfa8bd005 Mon Sep 17 00:00:00 2001
From: dakkar <dakkar@thenautilus.net>
Date: Sat, 12 Oct 2024 18:23:20 +0100
Subject: also ignore stale *failed* responses - #741

since `misskeyApi` doesn't pass us the request, we close over a copy
of the username we requested, to make sure it still matches the
current username value
---
 packages/frontend/src/components/MkSignin.vue | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

(limited to 'packages/frontend/src/components/MkSignin.vue')

diff --git a/packages/frontend/src/components/MkSignin.vue b/packages/frontend/src/components/MkSignin.vue
index 76a6537ccc..2ac5c41964 100644
--- a/packages/frontend/src/components/MkSignin.vue
+++ b/packages/frontend/src/components/MkSignin.vue
@@ -107,14 +107,17 @@ const props = withDefaults(defineProps<{
 });
 
 function onUsernameChange(): void {
+	const usernameRequested = username.value;
 	misskeyApi('users/show', {
-		username: username.value,
+		username: usernameRequested,
 	}).then(userResponse => {
 		if (userResponse.username === username.value) {
 			user.value = userResponse;
 		}
 	}, () => {
-		user.value = null;
+		if (usernameRequested === username.value) {
+			user.value = null;
+		}
 	});
 }
 
-- 
cgit v1.2.3-freya

