Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Use callback after form's setState

dominik-zeglen2af7ccae6b0a
diff --git a/saleor/static/dashboard-next/components/DebounceForm.tsx b/saleor/static/dashboard-next/components/DebounceForm.tsx
index 0fac679100..fdf681c0d6 100644
--- a/saleor/static/dashboard-next/components/DebounceForm.tsx
+++ b/saleor/static/dashboard-next/components/DebounceForm.tsx
@@ -2,7 +2,7 @@ import * as React from "react";
import Debounce from "./Debounce";
export interface DebounceFormProps {
- change: (event: React.ChangeEvent<any>) => void;
+ change: (event: React.ChangeEvent<any>, cb?: () => void) => void;
children: ((
props: (event: React.ChangeEvent<any>) => void
) => React.ReactNode);
@@ -19,8 +19,7 @@ export const DebounceForm: React.StatelessComponent<DebounceFormProps> = ({
<Debounce debounceFn={submit} time={time}>
{debounceFn =>
children(event => {
- change(event);
- debounceFn();
+ change(event, debounceFn);
})
}
</Debounce>