block ReloadButton while fetching

This commit is contained in:
vchikalkin 2023-05-07 14:37:57 +03:00
parent fdf795b47d
commit a01f99315b

View File

@ -7,12 +7,17 @@ import { ReloadOutlined } from 'ui/elements/icons';
export const ReloadButton = observer(
({ storeSelector, onClick }: { onClick: () => void; storeSelector: StoreSelector }) => {
const { $tables } = useStore();
const { validation } = storeSelector($tables.elt);
const { validation, getRows: rows } = storeSelector($tables.elt);
const hasErrors = validation.hasErrors;
return (
<Button onClick={onClick} disabled={hasErrors} shape="circle" icon={<ReloadOutlined />} />
<Button
onClick={onClick}
disabled={hasErrors || rows.some((x) => x.status === 'fetching')}
shape="circle"
icon={<ReloadOutlined />}
/>
);
}
);