diff --git a/packages/app/src/Element/AsyncButton.tsx b/packages/app/src/Element/AsyncButton.tsx index 34e6e10c..c130ab2f 100644 --- a/packages/app/src/Element/AsyncButton.tsx +++ b/packages/app/src/Element/AsyncButton.tsx @@ -2,6 +2,7 @@ import "./AsyncButton.css"; import { useState } from "react"; interface AsyncButtonProps extends React.ButtonHTMLAttributes { + disabled?: boolean; onClick(e: React.MouseEvent): Promise | void; children?: React.ReactNode; } @@ -31,7 +32,7 @@ export default function AsyncButton(props: AsyncButtonProps) { const [loading, setLoading] = useState(false); async function handle(e: React.MouseEvent) { - if (loading) return; + if (loading || props.disabled) return; setLoading(true); try { if (typeof props.onClick === "function") { @@ -46,7 +47,7 @@ export default function AsyncButton(props: AsyncButtonProps) { } return ( -