-
Notifications
You must be signed in to change notification settings - Fork 6
Develop #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Develop #27
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -184,9 +184,10 @@ export const CodeEditor = ({ | |
| await navigator.clipboard.writeText(activeFile.content); | ||
| setCopied(true); | ||
| setTimeout(() => setCopied(false), 2000); | ||
| }, []); | ||
| }, [activeFile]); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. issue (bug_risk): Guard
|
||
|
|
||
| const handleDownload = useCallback(() => { | ||
| if (!activeFile) {return;} | ||
| const blob = new Blob([activeFile.content], { type: "text/plain" }); | ||
| const url = URL.createObjectURL(blob); | ||
| const a = document.createElement("a"); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
handleCopyfunction should include a null check foractiveFilesimilar tohandleDownload. Line 149 shows thatactiveFileuses a fallback toeditorFiles[0], but ifeditorFilesis empty,activeFilecould beundefined, causing a runtime error when accessingactiveFile.content.