fix download button, was returning undefined as file contents

This commit is contained in:
Chandler Abraham
2025-05-31 15:08:45 -07:00
parent e3bc15a8d2
commit 69244ba445
@@ -3,7 +3,7 @@ import { useCallback } from 'react';
export default function DownloadButton({ context }) {
const handleDownload = useCallback(() => {
// Get the current code from the editor
const code = context.code;
const code = context.editorRef?.current?.code || '';
// Create a blob with the code
const blob = new Blob([code], { type: 'text/javascript' });
@@ -21,7 +21,7 @@ export default function DownloadButton({ context }) {
// Clean up the URL
window.URL.revokeObjectURL(url);
}, [context.code]);
}, []);
return (
<button