Skip to content

Commit

Permalink
Guard code editor on openedFile
Browse files Browse the repository at this point in the history
  • Loading branch information
benjreinhart committed Oct 22, 2024
1 parent 00cb5c8 commit ef632e0
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions packages/web/src/routes/apps/files-show.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@ import { CodeEditor } from '@/components/apps/editor';
import AppLayout from './layout';

export default function AppFilesShow() {
const { openedFile: _openedFile, updateFile } = useFiles();
const { openedFile, updateFile } = useFiles();

// TODO: Handle 404s from server.
const openedFile = _openedFile!;
/* TODO: Handle 404s */

return (
<AppLayout activeTab="code" activePanel="explorer">
<CodeEditor
path={openedFile.path}
source={openedFile.source}
onChange={(source) => updateFile(openedFile, { source })}
/>
{openedFile && (
<CodeEditor
path={openedFile.path}
source={openedFile.source}
onChange={(source) => updateFile(openedFile, { source })}
/>
)}
</AppLayout>
);
}

0 comments on commit ef632e0

Please sign in to comment.