From 4038de583dd04b23e017887dc9d0d030e904f43a Mon Sep 17 00:00:00 2001 From: ppc Date: Sat, 26 Oct 2024 18:07:57 +0100 Subject: [PATCH] fix card unselection on reload --- amnet-native/app/ServerCardIn.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/amnet-native/app/ServerCardIn.tsx b/amnet-native/app/ServerCardIn.tsx index 3437616..e631dfc 100644 --- a/amnet-native/app/ServerCardIn.tsx +++ b/amnet-native/app/ServerCardIn.tsx @@ -117,9 +117,6 @@ export default function ServerCardIn({route, navigation}) { if (matchingGameCard) { setDefaultCard(matchingGameCard); } - } else { - setSelectedCard(null); - setDefaultCard(null); } } else { setConnectionTestResult(false); @@ -130,8 +127,11 @@ export default function ServerCardIn({route, navigation}) { setServerRefreshing(false); }); - setTimeout(() => abortController.abort(), 5000); - return () => abortController.abort(); + const timeout = setTimeout(() => abortController.abort(), 5000); + return () => { + clearTimeout(timeout); + abortController.abort(); + } }, [serverId, serverReloadCounter, realm]); // card in callback