Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Improve debounce types and pass function parameters
dominik-zeglen8b5bece6c7a1
diff --git a/saleor/static/dashboard-next/components/Debounce.tsx b/saleor/static/dashboard-next/components/Debounce.tsxindex 522c4b20cd..13c0460b29 100644--- a/saleor/static/dashboard-next/components/Debounce.tsx+++ b/saleor/static/dashboard-next/components/Debounce.tsx@@ -1,20 +1,20 @@import * as React from "react";-export interface DebounceProps {- children: ((props: () => void) => React.ReactNode);- debounceFn: (event: React.FormEvent<any>) => void;+export interface DebounceProps<T> {+ children: ((props: (...args: T[]) => void) => React.ReactNode);+ debounceFn: (...args: T[]) => void;time?: number;}-export class Debounce extends React.Component<DebounceProps> {+export class Debounce<T> extends React.Component<DebounceProps<T>> {timer = null;- handleDebounce = () => {+ handleDebounce = (...args: T[]) => {const { debounceFn, time } = this.props;if (this.timer) {clearTimeout(this.timer);}- this.timer = setTimeout(debounceFn, time || 200);+ this.timer = setTimeout(() => debounceFn(...args), time || 200);};render() {