Skip to content

A full-featured CRM built with React, shadcn/ui, and Supabase.

replace setTimeout by requestAnimationFrame

ThieryMichel95e19a4fb979
diff --git a/src/components/admin/autocomplete-input.tsx b/src/components/admin/autocomplete-input.tsx
index 1984b076..2cd5d5b1 100644
--- a/src/components/admin/autocomplete-input.tsx
+++ b/src/components/admin/autocomplete-input.tsx
@@ -245,9 +245,9 @@ export const AutocompleteInput = (
value={filterValue}
onValueChange={(filter) => {
setFilterValue(filter);
- setTimeout(() => {
+ requestAnimationFrame(() => {
listRef.current?.scrollTo(0, 0);
- }, 0);
+ });
// We don't want the ChoicesContext to filter the choices if the input
// is not from a reference as it would also filter out the selected values
if (isFromReference) {