From bda5af893074c6bb17cdce44d9e0de6794c32b85 Mon Sep 17 00:00:00 2001 From: Andrew Date: Tue, 1 Apr 2025 02:40:34 +0100 Subject: [PATCH] [frontend]: Conditional debounce timeouts --- frontend/src/App.jsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index a6db786..46f4604 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -106,6 +106,11 @@ function App() { const handleSearchChange = (e) => { const value = e.target.value; + let timeout = 300; + + if (numMarkers > 5000) { + timeout = 400; + } if (debounceTimeout.current) { clearTimeout(debounceTimeout.current); @@ -113,7 +118,7 @@ function App() { debounceTimeout.current = setTimeout(() => { setSearchTerm(value); - }, 300); + }, timeout); }; // calculate distance between 2 points