Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Fix persisted search input handling

Tim Wilson53b264e47f53
diff --git a/apps/web/ui/shared/search-box.tsx b/apps/web/ui/shared/search-box.tsx
index 340ac6aa84..08c5afc06c 100644
--- a/apps/web/ui/shared/search-box.tsx
+++ b/apps/web/ui/shared/search-box.tsx
@@ -124,7 +124,9 @@ export function SearchBoxPersisted({
// Set value when URL param changes
useEffect(() => {
const search = searchParams.get(urlParam);
- if (search ?? "" !== value) setValue(search ?? "");
+ // Only update if the value and debouncedValue are synced (the user isn't actively typing)
+ if ((search ?? "" !== value) && value === debouncedValue)
+ setValue(search ?? "");
}, [searchParams.get(urlParam)]);
return (