From 0ec62f9d2ee0e4eb092d07fe251a2fce86f58d85 Mon Sep 17 00:00:00 2001 From: SimolZimol <70102430+SimolZimol@users.noreply.github.com> Date: Fri, 7 Aug 2026 22:46:59 +0200 Subject: [PATCH] modified: static/js/game.js --- static/js/game.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/static/js/game.js b/static/js/game.js index 2f144ed..fc83a54 100644 --- a/static/js/game.js +++ b/static/js/game.js @@ -76,6 +76,7 @@ // ---------- Suche / Autocomplete ---------- let searchTimer = null; + let searchSeq = 0; let suggestions = []; let selectedIndex = -1; @@ -84,7 +85,10 @@ const q = searchInput.value.trim(); if (!q) { closeAutocomplete(); return; } searchTimer = setTimeout(async () => { + const mySeq = ++searchSeq; const res = await fetch(`/api/search?q=${encodeURIComponent(q)}`); + // Nur die aktuellste Anfrage uebernehmen (Race vermeiden) + if (mySeq !== searchSeq) return; suggestions = await res.json(); renderAutocomplete(); }, 200);