Fix: disable download button when no data available

This commit is contained in:
Prince EKPINSE committed 2025-11-08 18:17:22 +01:00
1 parent 6ba9c1c40c
commit c3f3a7db3f
2 files changed
+28609 -1

No files matched your search

+28605
View File
File diff suppressed because it is too large. Load diff
+4 -1
View File
@@ -14,12 +14,15 @@ export function DownloadButton({
const { formatMessage, labels } = useMessages();
const handleClick = async () => {
if (!data || data.length === 0) {
return;
}
downloadCsv(`${filename}.csv`, Papa.unparse(data));
};
return (
<TooltipTrigger delay={0}>
<Button variant="quiet" onClick={handleClick} isDisabled={!data}>
<Button variant="quiet" onClick={handleClick} isDisabled={!data || data.length === 0}>
<Icon>
<Download />
</Icon>