diff --git a/webapp/src/pages/Stats/Stats.js b/webapp/src/pages/Stats/Stats.js
index cdb0c2cc..1ed03d73 100644
--- a/webapp/src/pages/Stats/Stats.js
+++ b/webapp/src/pages/Stats/Stats.js
@@ -11,6 +11,7 @@ const Stats = () => {
const [gamemode, setGamemode] = useState("clasico");
const [isLoading, setIsLoading] = useState(false);
const [error, setError] = useState(null);
+ const [fetched,setFetched] = useState(false);
const fetchStats = () => {
setIsLoading(true);
@@ -28,7 +29,11 @@ const Stats = () => {
};
useEffect(() => {
- fetchStats(); // Eliminamos el retardo para la primera llamada
+ if(!fetched){
+ fetchStats();
+ setFetched(true);
+ }
+
}, [username, gamemode]);
const handleUsernameChange = (event) => {
@@ -41,6 +46,10 @@ const Stats = () => {
fetchStats();
};
+ const handleSearch = () => {
+ fetchStats();
+ };
+
const getModeName = () => {
if(gamemode=="clasico"){
return "Clásico";
@@ -72,6 +81,7 @@ const Stats = () => {
onChange={handleUsernameChange}
data-testid="usernameInput"
/>
+
Por favor compruebe si los valores del formulario son correctos e @@ -95,6 +105,7 @@ const Stats = () => { onChange={handleUsernameChange} data-testid="usernameInput" /> +