Skip to content

Commit cf1b2d3

Browse files
committed
Perf: added debouncer to category update
1 parent b051769 commit cf1b2d3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/components/controls/select/seats/categorizer.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Trash2 } from "lucide-react";
22
import { useSelector } from "react-redux";
3+
import { debounce } from "lodash";
34
import { Input, Popover, PopoverContent, PopoverTrigger } from "@/components/core";
45
import { dataAttributes } from "@/constants";
56
import { store } from "@/store";
@@ -10,10 +11,11 @@ const onAddCategory = () => store.dispatch(addCategory(undefined));
1011

1112
const onDeleteCategory = (id: string) => store.dispatch(deleteCategory(id));
1213

13-
const onUpdateCategory = (category) => store.dispatch(updateCategory(category));
14+
const onUpdateCategory = debounce((category) => store.dispatch(updateCategory(category)), 150);
1415

1516
const Categorizer = ({ firstElement, selectedElementIds }) => {
1617
const categories = useSelector((state: any) => state.editor.categories);
18+
1719
return (
1820
<>
1921
<div className="w-full flex justify-between items-center gap-12">

0 commit comments

Comments
 (0)