Skip to content

Commit a347856

Browse files
committed
Update contract-function.tsx
1 parent eac3e6d commit a347856

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

apps/dashboard/src/components/contract-functions/contract-function.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import * as ERC1155Ext from "thirdweb/extensions/erc1155";
3434
import { useReadContract } from "thirdweb/react";
3535
import { toFunctionSelector } from "thirdweb/utils";
3636
import { Badge, Button, Card, Heading, Text } from "tw-components";
37+
import { useDebouncedCallback } from "use-debounce";
3738
import { useContractFunctionSelectors } from "../../contract-ui/hooks/useContractFunctionSelectors";
3839
import {
3940
COMMANDS,
@@ -333,9 +334,12 @@ export const ContractFunctionsPanel: React.FC<ContractFunctionsPanelProps> = ({
333334
: 0;
334335

335336
const [keywordSearch, setKeywordSearch] = useState<string>("");
336-
const handleKeywordSearch = (e: React.ChangeEvent<HTMLInputElement>) => {
337-
setKeywordSearch(e.target.value);
338-
};
337+
const handleKeywordSearch = useDebouncedCallback(
338+
(e: React.ChangeEvent<HTMLInputElement>) => {
339+
setKeywordSearch(e.target.value);
340+
},
341+
300,
342+
);
339343

340344
const functionSection = (e: ExtensionFunctions) => {
341345
const filteredFunctions = keywordSearch

0 commit comments

Comments
 (0)